Linux jobs Command: List Jobs in the Current Shell

jobs shows the background jobs and stopped jobs managed by the current Bash shell. It differs in scope from ps, which queries all processes on the system.

The shell's job number is indicated like %1, and the operating system process ID is a numeric PID. One job can consist of multiple processes, such as in a pipeline. Jobs started from another terminal or shell do not appear in the current shell's jobs list.

Basic syntax

jobs [options] [job_specifier]

Installed implementations and options may vary depending on the distribution. Use help jobs to check the description for the current system.

Examples

Starting a background job

An ending & starts the command as a background job.

sleep 120 &

Checking jobs in the current shell

Check the job number, status, and original command.

jobs

Also display PID

Compare the job number with the actual PID.

jobs -l

Reading the current shell's job numbers

jobs shows background or suspended jobs started in the current shell, not system-wide processes.

sleep 60 &
jobs -l

Example output (PID and job numbers will differ):

[1]+ 12345 Running  sleep 60 &

[1] is the job number in this shell, and 12345 is the process PID. Running jobs in another terminal or a new shell will not show this job. If you need to keep the job after closing the shell, consider nohup, tmux, or a service manager.

Main Options and Format

Options/Format Description
-l Display PID along with job status.
-p Display only the representative PID of the job's process group.
-r Display only running jobs.
-s Display only stopped jobs.

Precautions when using

jobs is a shell built-in command and only queries the job table of the current shell. Job control may be disabled in scripts or non-interactive shells. The sleep job in the example will disappear from the list after some time, and if it remains, it can be terminated with the shell's job number like kill %1.

Frequently Asked Questions

Why are jobs empty but processes visible in ps?

The reason is that jobs only shows the tasks currently started and managed by the shell, whereas ps queries the list of system processes.

Official Documentation

You can check the exact behavior of the options and differences depending on the implementation in the official documentation on jobs.