$linuxjunkies
>

jobs(1)

Display status of jobs in the current shell session.

UbuntuDebianFedoraArch

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

FlagWhat it does
-lList process IDs (PIDs) in addition to the normal information
-pShow only the process IDs of running jobs
-nShow only jobs that have changed status since the last notification
-rDisplay only running jobs
-sDisplay only stopped jobs
-aList all jobs (even those not in the current session)
-xReplace job specifications in subsequent arguments with PIDs

Examples

List all active jobs in the current shell

jobs

List all jobs with their process IDs

jobs -l

Show only currently running background jobs

jobs -r

Show only stopped jobs (suspended with Ctrl+Z)

jobs -s

Show status of job number 1 specifically

jobs %1

Kill all background jobs by passing their PIDs to kill

jobs -p | xargs kill

Related commands