jobs — List shell jobs
Linux / Service and process management / jobs.html
A shell builtin that lists background and stopped jobs managed by the current shell.
Basic Information
| Command Name | jobs |
|---|---|
| One-line Introduction | A shell builtin that lists background and stopped jobs managed by the current shell. |
| Provided by | Bash and POSIX shell builtin |
| Official Documentation | https://www.gnu.org/software/bash/manual/html_node/Job-Control-Builtins.html |
| Supported Operating Systems | Linux, macOS, BSD |
| Installation Status | Installed by default (shell builtin) |
| Category | Linux service and process management (tags: Process and resource management (tags: job control, background, shell)) |
What is this command?
jobs is a builtin that lists job numbers and states for the current shell session.
Those job numbers feed bg, fg and kill; jobs from other shells are invisible.
What problems does it solve?
- See whether a background job finished.
- Find the number needed to resume a stopped job.
- Review the state of several jobs at once.
- Clean up remaining jobs in a script.
Key features
Job list
Prints running, stopped and finished jobs with numbers.
- When to use: Checking job state in the current shell
- What you get: Job numbers and states
- Limitations: Jobs in other shells are not shown
Include PIDs
The -l option also shows the process group ID.
- When to use: When working with PIDs directly
- What you get: Mapping of job number to PID
- Limitations: Output differs from external tools
Selecting by state
You can list only running or only stopped jobs.
- When to use: When resuming only stopped jobs
- What you get: Only the requested state
- Limitations: Job numbers are session specific
Installation and usage
Check whether it is installed
help jobs
man bash # jobs is a shell builtin
Real-world examples
List jobs
Show jobs in the current shell.
# Show jobs in the current shell
jobs
With PIDs
Show process group IDs too.
# Include process group IDs
jobs -l
Stopped only
List only stopped jobs.
# List only stopped jobs
jobs -s