Running processes as background jobs

To run a process in the background as a job and carry on working add an & (ampersand) at the end of the command line. For example:

   find /usr/man -name *.1 -print > sect1 &
   [1] 2548

The shell forks a child process to run the command and displays the job number ([n]) and the PID (Process IDentifier) number. The shell prompt returns and you can enter further commands.

Redirect the standard output for a command that is being run in the background to a file. This prevents the output from the command appearing on your screen and interrupting your current work.

If the command is likely to produce error messages you will need to redirect standard error. Otherwise all error messages are sent to your screen.

Do not run an interactive command that requires you to type something at the terminal as a background job. If you do the job will stop and wait for user input. You will then have to kill its process.


[Home] [Search] [Index] This site maintained by unixhelp@ed.ac.uk