The shell gives you the ability to execute several jobs simultaneously, a capability known as multitasking. Coordination of these multiple jobs within the shell is called job control.

A job can be anything from an executed application to a print request. These jobs can be run in the foreground or background.

Jobs that are run in the foreground tie up your terminal until they are finished. Jobs that run in the background do not tie up your terminal while they are running, which allows you to start other jobs without waiting for the first job to finish. Background jobs do not display any output to the screen, so they are harder to monitor. Whether they are foreground or background jobs though, each job is assigned a job ID.

You can control jobs based on their assigned job ID by jobs.

Note: The job command can only control jobs in the window in which the job was started.

Command Format

jobs

The following commands are used to control jobs :

Option Value
jobs Displays jobs currently running
command & Puts a job in the background
fg %n Puts a job in the foreground
kill %n Aborts a specified background job, based on its job ID.
Control-z Suspends a foreground job
Control-c Aborts a foreground job

Note: n=job number