Bash: Job Control

About Job Control

Say your writing a program using vi, and you want to check your email. You do not have to open a new terminal. Job control will let you go back to your shell and run a new program without leaving the program your on.

Job control refers to the ability to selectively stop (suspend) the execution of processes and continue (resume) their execution at a later point.

More information can be found using man bash.

Suspending your current program

The most common way to suspend a program is CTRL+Z. This is the key the shell looks for while running a program. Some programs override that key however. For example, to suspend bash itself, use the suspend command.

When you suspend a program, you will be returned to the shell, and the shell will give a number, identifying the job.

  [2]+  Stopped                 vi jobs.html

The number in square brackets is the job number. On the right is the program that was suspended.

Listing the current jobs

Type jobs. You will see a listing like this:

  [1]   Stopped                 su  (wd: /etc)
  [2]+  Stopped                 vi jobs.html
  [3]-  Stopped                 telnet

Starting a suspended job

There are two ways to start a job.

Last Updated: 2000 April 9, by Jason Long