Good Resources

The Linux Command Line – free pdf book

Get previously entered commands

Use the up and down cursor keys.

Issuing multiple commands in a single line

If subsequent commands should only occur if the previous command succeeded use "&&":


sudo ifdown eth0 && sudo ifup eth0

If subsequent commands should occur regardless of whether the previous command succeeded use ";" :


sudo ifdown eth0 ; sudo ifup eth0
​

Issuing Commands In The Background

To issue a command and exit immediately you can simply add a space followed by a '&' character at the end of the line.  If the command has responses that come later they will still be output to the console (you'll see them) but you will be free to use the console for other tasks commands.

If you want to issue multiple commands simple surround the ';' seperated commands in brackets and follow with a '&', e.g.: (sleep 2 ; sudo /sbin/reboot ) &

Getting error and normal responses

Simply add " 2>&1" to the end of your command string and you will then get the output of stdout and stderr

 

USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.