Jobs
are run in the foreground by default, which means they tie up your
terminal until they are complete. If you want to run a job in the
background, type the command followed by an ampersand (&). When
you hit enter (to execute the command) the job ID number will be
displayed in brackets.
Searching
a large directory with the
find command is an example of a time-consuming job:
$ find /
-name core -print > trash 2>&1 &
[1] 3923
In this
example, each argument has the following meanings:
| Argument |
Meaning |
| > |
Redirect
standard output (1) to filename |
| trash |
File
used to capture standard output (1) and standard error (2)
|
| 2>&1 |
Redirect
standard error (2) to standard output (1) |
| & |
Process
job in the background |
The
responses returned and displayed by the system have the following
definition:
| Response |
Definition |
| [1]
|
Indicates
the job ID number |
| 3923 |
Indicates
the process ID number |
When
the background process has completed and you are still working
in the shell, you will see a message indicating that the background
process is done.
[job-id]
+ Done job description. . .