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.

What is the jobs command?

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.

More in This Category
Linux head Command: Display the Beginning of a File

Linux head Command: Display the Beginning of a File

Learn how Linux head prints the first lines or bytes of files and pipelines, labels multiple inputs, excludes a trailing portion, and handles multibyte data.

Linux csplit Command: Split Files at Lines or Patterns

Linux csplit Command: Split Files at Lines or Patterns

Learn how to split Files at Lines or Patterns with the Linux csplit command, including practical examples, key options, and important precautions.

Linux printenv Command: Print Environment Variable Values

Linux printenv Command: Print Environment Variable Values

Learn how to use the Linux printenv command to print all environment variables or selected variable values, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux Tutorial / Search and Process Text with grep, sort, uniq, cut, and wc

Linux Tutorial / Search and Process Text with grep, sort, uniq, cut, and wc

Practice searching, sorting, grouping, extracting, and counting text with grep, sort, uniq, cut, and wc, including reproducible output and key caveats.

Linux type Command: Identify How a Command Is Resolved

Linux type Command: Identify How a Command Is Resolved

Learn how to use the Linux type command to identify aliases, functions, built-ins, keywords, and executable paths, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux modinfo Command: Inspect Kernel Module Details

Linux modinfo Command: Inspect Kernel Module Details

Learn how to inspect Kernel Module Details with the Linux modinfo command, including practical examples, key options, and important precautions.

Linux Tutorial / Find Files and Commands with find, locate, which, and whereis

Linux Tutorial / Find Files and Commands with find, locate, which, and whereis

Compare find and locate for file searches, then use which, whereis, and Bash type to distinguish executable paths from shell command resolution.

Linux watch Command: Run a Command Repeatedly

Linux watch Command: Run a Command Repeatedly

Learn how to use the Linux watch command to rerun a command at regular intervals and highlight changing output, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux dpkg Command: Inspect and Install Local DEB Packages

Linux dpkg Command: Inspect and Install Local DEB Packages

Learn how to inspect and Install Local DEB Packages with the Linux dpkg command, including practical examples, key options, and important precautions.

Linux history Command: Review and Reuse Shell Command History

Linux history Command: Review and Reuse Shell Command History

Learn how to use the Linux history command to review, search, reuse, and manage shell command history, with essential options, practical examples, output interpretation, and common troubleshooting tips.