Por: Gonzalo Escribano
BASH: Run tasks in the background
January 24, 2012
Run tasks in the background
bash lets you runone or more tasks in the background, and selectively suspend or resume any ofthe current tasks (or “jobs”). To run a task in the background, addan ampersand (&) to the end of its command line. Here’s an example:
bash> tail -f /var/log/messages &
 614Eachtask back-grounded in this manner in assigned a job ID, which is printed to theconsole. A task can be brought back to the foreground with the command fgjobnumber, where jobnumber is the job IDof the task you wish to bring to the foreground. Here’s an example:
bash> fg 1Alist of active jobs can be obtained at any time by typing jobs at the bash prompt.