Tag Info

Hot answers tagged

14

To print a sequence of number the command 'seq' is your friend seq 8


9

This is not actually a particularly good job for sed but here goes: sed -nr 's#.*/([^"]+).jpg.*#\1#p' file The above will get you a list of numbers, one per line: 20 20 32 32 32 30 30 30 Now, it is actually possible to get all these on the same line with 7 numbers per line using sed but it is really not worth the effort. Just use standard *nix tools ...


8

I assume you're trying to scrape some sort of result. In this example there are only three balls and we can extract them by searching for Balls/<one-or-many-digits> and grouping (the \(..\) construct) around the number and then replacing the whole lot with that group (the \1 is a reference to the first group). $ sed -n 's/.*Balls\/\([0-9]\+\).*/\1/gp' ...


7

{1..8} will give you a simple argument range in Bash. If you need that line by line, I'd suggest feeding that to something like printf: $ printf '%d\n' {1..8} 1 2 3 4 5 6 7 8


7

I assume you're seeing this host% in documentation. It stands for the shell prompt. ("Shell" is the program that reads the commands you type; "prompt" is the little bit of text that this program displays on your screen to say that it's ready to read your next command.) If you look at a terminal window on your computer you'll probably see something like ...


6

I open this question because it is got me interested. I did't know what is host%. But the answer is more easier then I was thinking. I'v google it and found this tutorial, where we can see this magically host%. This is so called Shell Prompt. Thing that usually appear before each command in terminal emulator. It is usually provide some information to user. ...


4

Use the built-in command history: history -w hist.txt will save the current history into file hist.txt. If you have write permsiions to the appropriate directory you could do something like: history -w /var/www/html/latest_history.txt Then your students could access it in a browser: http://teachers.ip.address/latest_history.txt


4

Simple really - you need to separate the commands. For instance this: #!/bin/bash sudo apt-get update sudo apt-get upgrade will update the package lists, and then the packages. Another possibility is this (probably better, as the && will only allow the upgrade command to run if the update exits successfully): #!/bin/bash sudo apt-get update ...


4

One option would be to escape the $ in your awk expression watch "ls -hal ./file |awk '{print \$5}'" Alternatively, you could avoid the issue altogether by using stat instead of parsing the output of ls watch stat -c '%s' ./file


4

last -t YYYYMMDDHHMMSS shows the status of the login files up to the date specified, rather than since the date specified.


4

espeak espeak is a multi-lingual software speech synthesizer. sudo apt-get install espeak espeak "hello" spd-say spd-say sends text-to-speech output request to speech-dispatcher sudo apt-get install speech-dispatcher spd-say "hello" say say converts text to audible speech using the GNUstep speech engine. sudo apt-get install gnustep-gui-runtime say ...


3

You can also use echo command with brace expansion echo -e "\n"{1..8} 1 2 3 4 5 6 7 8


3

Alternatively you can get it with simplest way as follows: $ echo {1..8} | tr ' ' '\n' 1 2 3 4 5 6 7 8 OR: $ for ((i=1 ; i<=8 ; i++)) do echo $i ; done; 1 2 3 4 5 6 7 8 8 can be replaced by your 'N' positive integer!


2

Try using: gksudo -k -u root -- nice --20 gnome-system-monitor The double dash (--) signifies the end of the parameter list for gksudo, so it doesn't try to interpret the --20 as a parameter to gksudo. More information about this "bare double dash" can be found on Unix & Linux Stack Exchange.


2

Use following command : watch 'ls -hal ./file|cut -d " " -f 5' And if you want to highlight difference than, watch -d 'ls -hal ./file|cut -d " " -f 5' This will give work as you want!


2

There seems to be more than one issue: 1. Bug #1276348 ssh-agent is missing in backintime-kde in versions <= 1.0.34. Please install this patch with sudo patch /usr/bin/backintime-kde4 < backintime-kde4.diff 2. sudo vs. kdesudo sudo doesn't change $HOME but kdesudo does. $ sudo env | grep ^HOME HOME=/home/germar $ kdesudo env | grep ^HOME ...


2

I'd say you've found it in simple loops but you could do a number of things from here: Write a function to handle that for you function uberwatch { # syntax uberwatch <interval> <command> while true; ${@:3}; sleep $2; done } You could lodge that somewhere around your ~/.bashrc. Log the output to file but keep viewing with watch ...


1

I don't know a way to actively scan a network for live systems, although I'm sure such tools exist. However if you just want to know what systems are connected and which MAC address they have I would just have a look at the list of active clients on your router/DHCP server. You can then enable MAC filtering on your firewall and white list the MAC addresses ...


1

There's a command called arp-scan that might do the trick for you, you will need to install it first: sudo apt-get install arp-scan Here's a link to the man pages that will outline how to use it: http://manpages.ubuntu.com/manpages/trusty/man1/arp-scan.1.html As an example though, you could do this: sudo arp-scan --interface=eth0 --localnet Where eth0 ...


1

I had exactly the same problem and solve it by installing dropbox following these instructions, but substituting nautilus-dropbox by dropbox. That is, I installed dropbox by executing these commands: sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 5044912E sudo add-apt-repository "deb http://linux.dropbox.com/ubuntu $(lsb_release -sc) main" sudo ...


1

I installed dropbox from the app provided in the Ubuntu Software Centre and works well placing an icon in the top bar of the screen.


1

It was related to ordering of params. As assisted by @Muru ordering should be unzip -P$password "$source_file" -d "$destination_directory" Thanks.


1

Just to add a few points to the excellent answer by @Wilf, you can run commands in paralell if you want for any reason, for example, an autostart script for OpenBox might look like this: #!/bin/bash nitrogen --restore & tint2 & tilda This will set a background image using nitrogen, start the panel tint2 and start the Quake3-style dropdown ...


1

module show like sip is returning something? if not do this module load chan_sip.so and try again


1

Commands can produce output on stdout or stderr. The commands that you tried redirected only stdout. Under bash, you can redirect the output from both streams at once using: command &>test.txt & Or command &>/dev/null & If you are using a POSIX shell, then you need to do the redirection in steps: command >test.txt ...


1

If wine is installed on his PC the script is just: #!/bin/bash wine iTunesInstallerName.exe Put that together with the iTunes installer in a directory and tell him to run the script. It will start the installation process.


1

You can try the following bash function #!/bin/bash function get_password(){ echo "Enter wour password: " read password if [[ -n "$password" ]]; then a=$(echo $password | tr -d "\n" | wc -c) b=$(echo $password | tr -cd "[:alnum:]" | wc -c) if [[ $a != $b ]]; then echo "Plz enter alphanumeric words" ...


1

Make the script executable with: chmod +x ./OculusConfigUtil_i386 Then run it with ./OculusConfigUtil_i386. Both errors result from the missing execute premissions.


1

Use sudo apt-get install libudev1 if libudev.so.1 is not already installed then: sudo ln -sf /lib/x86_64-linux-gnu/libudev.so.1 /lib/x86_64-linux-gnu/libudev.so.0


1

x-terminal-emulator is a virtual package. The terminal emulator is configured by Debian's alternative system. On Ubuntu you can easily follow this symlink construction, e.g. for gnome-terminal: $ which x-terminal-emulator /usr/bin/x-terminal-emulator $ ll /usr/bin/x-terminal-emulator /usr/bin/x-terminal-emulator -> /etc/alternatives/x-terminal-emulator* ...



Only top voted, non community-wiki answers of a minimum length are eligible