OpenWindows Advanced User's Guide

2.2.6 Running Commands in the Background

Often, it is convenient to initiate a command from the command prompt and then place that command in the background. When a command is not placed in the background, the next prompt does not appear until the command completes its task. However, some commands can take a long time to finish, and you might prefer to enter other commands in the meantime.

If you know you want to run a command in the background, type an ampersand (&) after the command as shown below. The number that follows is the process id:

$ bigjob &
[1] 21414
$ 

The command bigjob will now run in the background, and you can continue to enter other commands. After the job completes, you will see a message similar to the following the next time you enter another command, such as date in this example:

$ date
Mon Feb 3 10:23:25 PST 1992
[1]  + Done    bigjob
$ 

If you are likely to log off before a background job completes, use the nohup (no hangup) command to allow the job to complete, as shown in this example. Otherwise, the background job will be terminated when you log off:

$ nohup bigjob &
[1] 21414
$