DevOps Essentials

View on GitHub



Job control is nothing but the ability to stop/suspend the execution of processes (command) and continue/resume their execution as per your requirements. This is done using your operating system and shell such as bash/ksh or POSIX shell. Your shell keeps a table of currently executing jobs and can be displayed with jobs command.


It’s a shell builtin Shell builtin commands are commands that can be executed within the running shell’s process.


Displays status of jobs in the current shell session.


jobs [-lnprs] [ jobspec … ]

jobs -x command [ args …

The basic syntax is as follows:



Before you start using jobs command, you need to start couple of jobs on your system. Type the following commands to start jobs:

xeyes &
gnome-calculator &
gedit &

Finally, run ping command in foreground:


To suspend ping command job hit the Ctrl-Z key sequence.

To display the status of jobs in the current shell, enter:

$ jobs
[1]   7895 Running                 gpass &
[2]   7906 Running                 gnome-calculator &
[3]-  7910 Running                 gedit &
[4]+  7946 Stopped                 ping

To display the process ID or jobs for the job whose name begins with “p,” enter:

$ jobs -p %p
[4]-  Stopped                 ping

To show process IDs in addition to the normal information

$ jobs -l
[1]  + 47274 suspended  ping

To list only processes that have changed status since the last notification

$ sleep 100 &
$ jobs -n
[5]-  Running                 sleep 100 &

Display lists process IDs (PIDs) only

$ jobs -p

A note about /usr/bin/jobs and shell builtin

$ type -a jobs
jobs is a shell builtin
jobs is /usr/bin/jobs

In almost all cases you need to use the jobs command that is implemented as a BASH/KSH/POSIX shell built-in. The /usr/bin/jobs command can not be used in the current shell. The /usr/bin/jobs command operates in a different environment and does not share the parent bash/ksh’s shells understanding of jobs.