Tag Info

Hot answers tagged

8

The name of a variable is a placeholder for its value, the data it holds. Referencing (retrieving) its value is called variable substitution. The $ sign helps us to get the value. Let us carefully distinguish between the name of a variable and its value. If variable1 is the name of a variable, then $variable1 is a reference to its value, the data item it ...


5

I am unable to comment due to insufficient reputation however @Edwin Hernandez crontab example of */15, *, *, *, * sudo bash -c "sleep 1h; pm-suspend" is incorrect as there should not be commas between the fields (each of the stars are a separate field). @Mitch♦ has the correct format. cron's format is: m h dom mon dow command m is the minute, h is the ...


5

Using rename A generally useful tool for this type of activity is rename from the perl package. It applies a perl substitution to the file name: rename 's/file/file0/' file[0-9][0-9].ext How this works: s/file/file0/ This is a perl substitution command. It replaces the occurrence of file in a file name with file0. file[0-9][0-9].ext This is the ...


5

There are multiple answers here, depending on what you want (this answer is valid in bash and zsh shells, others may vary). If you need to run a command in background and you know it before running it, simply add a & at the end of the command (using sleep 60, do nothing during 1 minute, as example command): [romano:~] % sleep 60 & [1] 9054 1& ...


2

apt-get remove removes the package in question apt-get purge is equivalent to apt-get remove --purge and will remove user data/configuration files. From man apt-get: purge purge is identical to remove except that packages are removed and purged (any configuration files are deleted too). and --purge Use purge instead of remove for ...


2

Variables in your shell are marked with a $. I assume a path has been stored as $FOAM_RUN. You can see all variables in your shell by running: $ env XDG_SESSION_ID=2 GDM_LANG=en_US.utf8 XDG_RUNTIME_DIR=/run/user/1000 WINDOWID=41943044 HOME=/home/orangetux XDG_VTNR=7 SSH_AGENT_PID=1774 XDG_SEAT=seat0 COLORTERM=gnome-terminal ... You can see the the value ...


2

This example will run updates in the background: sudo apt-get dist-upgrade -y & Just note the singe &. If you want to hide the stdout, do following: sudo apt-get dist-upgrade -y > /dev/null &


2

add & to the command. Example: $ cp FromA ToB &


2

You see: bash: cd: /media/geo/Novo: No such file or directory since you tried to set a variable for the folder "/media/geo/Novo volume/Geo" (with a space) and the error is about only the first part of the path up to the space, you see, that the space is wrongly treated as separator. If you want to use cd $geo yuo could have to include the quotes in ...


2

nslookup itself doesn't have support for CIDR notation, ranges or wildcards, so your best option is likely a simple bash loop. for ip in 192.168.1.{2..20}; do nslookup $ip; done


2

Yes, the terminal emulator and the shell are too different programs. As you're aware, one example of the difference is that launching a terminal window can run different shells depending on what you have configured (bash, tcsh, ksh, ash, even python!). Another difference is that there are more terminal emulators than just the default: gnome-terminal, ...


1

best I could find on my own (and I'm a newbie) was just running 'apt-get check' for a clue as to how things turned out following an install. Also running 'script' prior to running an 'apt-get install' will capture all the output from the command to file so that you don't have to worry about it scrolling away.


1

echo ${PWD##*/} Go this from this post in the past: http://stackoverflow.com/questions/1371261/get-current-directory-name-without-full-path-in-bash-script if you want the full path then just: pwd


1

rsync command doesn't create directory tree, so you can do this by perform: mkdir -p /data/dir_1/dir_2/dir_3 before rsync command or use --rsync-path options: --rsync-path=PROGRAM Use this to specify what program is to be run on the remote machine to start-up rsync. Your command should be: rsync -avz ...


1

A step by step guide would be like: Editing your crontab: type in a terminal: $ crontab -e Add the following line to it. */15 * * * * sudo bash -c "sleep 1h; pm-suspend" Save and quit: type :wq and then press enter if you are on vi.


1

The answer of dfarrell07 solves the problem in a general way, not depending on nslookup - which is the right way to do it I think. But for the sake of diversity, and shell syntax examples, here is another approach, more related to the domain name lookup: The lookup program could be told to handle all addresses at once; That seems to be tricky with ...


1

Stolen from this SO question If you do cd "$geo" I'll bet you get the right result That being said, try doing alias geo="cd /media/geo/OS/Users/Geo" and then just using geo (as a command) to go there.


1

All you need to do is quoting the variable, since it contains a space character. cd "$geo" Quoting variables which might contain spaces is always good practice in shell code.


1

I believe you are looking for something like this: ls -d /home/$USER/Documents/*/ it will list all dirs in Documents. The last "/" makes it "directories" only.


1

rmdir removes empty directories, not files, and not directories unless they are empty. rm will remove files and/or directories, use the -R or -r flag for directories. To remove non-empty directories: rm -rf the option --dir is the same as -d , it will remove empty directories, same as rmdir As far as I know the commands do the same thing and it is user ...


1

The issue is that echo file.gz just echoes a string "file.gz". Basically the difference between the commands is: What you want: gunzip /path/to/directory/file.gz What you're giving it with the echo: gunzip "file.gz" However, even this isn't entirely correct. The true difference is that instead of a reference to the file file.gz you're sending in only ...


1

This rename with using different regex: rename -n 's/[^0-9](([0-9]){2})\.ext$/0$1.ext/' * [^0-9](([0-9]){2})\.ext$ Matches any non-digit[^0-9] followed by group of numbers with length=2 which is ends with .ext. So in replacement part, add a 0 and prints group of matched $1 and then their extension. Or alternative for regex: rename -n ...


1

The man page for apt-get has the following information - remove remove is identical to install except that packages are removed instead of installed. Note that removing a package leaves its configuration files on the system. If a plus sign is appended to the package name (with no intervening space), the identified ...


1

If you want to install it "over" your existing vanilla installation, you can do that through the software center. It's called ubuntu-gnome-desktop. You can also install this by opening a terminal and typing the following commands sudo apt-get update sudo apt-get install ubuntu-gnome-desktop



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