jobs(1)
Display status of jobs in the current shell session.
Synopsis
jobs [OPTION]... [JOBSPEC]...Description
The jobs command lists all jobs that have been started in the current shell, including running, stopped, and completed background processes. Each job is assigned a job number (shown in brackets) for reference with other shell commands.
Job numbers are local to the current shell session and are used with the percent sign (%) to manipulate processes—for example, fg %1 brings job 1 to the foreground. When a job completes, it remains listed until the shell reads the next prompt.
Common options
| Flag | What it does |
|---|---|
-l | List process IDs (PIDs) in addition to the normal information |
-p | Show only the process IDs of running jobs |
-n | Show only jobs that have changed status since the last notification |
-r | Display only running jobs |
-s | Display only stopped jobs |
-a | List all jobs (even those not in the current session) |
-x | Replace job specifications in subsequent arguments with PIDs |
Examples
List all active jobs in the current shell
jobsList all jobs with their process IDs
jobs -lShow only currently running background jobs
jobs -rShow only stopped jobs (suspended with Ctrl+Z)
jobs -sShow status of job number 1 specifically
jobs %1Kill all background jobs by passing their PIDs to kill
jobs -p | xargs kill