A background process is a computer process that runs “behind the scenes” (i.e. in the background) and without user intervention. Typical tasks for these processes include logging, system monitoring, scheduling, and user notification. On a Unix system, a background process or job can be further identified as one whose group ID differs from its terminal group ID. This type of process is unable to receive keyboard signals from and typically will not send output to its parent terminal.This more technical definition does not distinguish between whether or not the process can receive user intervention.Although background processes are typically used for purposes requiring few resources, any process can be run in the background, and even though the process is running in the background, where it can’t be seen, it behaves like any other process. A background process executes independently of the shell, leaving the terminal free for other work. To run a process in the background, include an
&(an ampersand) at the end of the command you use to run the job.
The & is an important little character in UNIX, it means “run the command in the background” i.e. detach it from the window it was started from, so it does not block the command line.
To run the
count program, which will display the process identification number of the job, enter:
To check the status of your job, enter:
To bring a background process to the foreground, enter
$fg or you can use % also.
If you have more than one background job to choose from (“jobs” will show you), then use for example “%2” to choose the second one.
You can kill a background process by entering:
To determine a job’s PID, enter