jobs
List active jobs
Overview
Displays the status of jobs started in the current shell session (background processes).
Syntax
jobs [OPTION]... [JOB_SPEC...]Common Options
-lList Process IDs (PIDs) in addition to the normal job information.
-pList only the PIDs of the jobs. This is useful for scripting.
-nDisplay only jobs that have changed status since the user was last notified.
-rRestrict output to running jobs.
-sRestrict output to stopped (suspended) jobs.
[jobspec...]If jobspec (e.g., %1, %+, %process_name) is given, output information only for that specific job.
Examples
Lists all active jobs (running or stopped) in the current shell.
Lists active jobs along with their PIDs and state.
Lists only the PIDs of all active jobs.
Lists only running jobs.
Lists only stopped (suspended) jobs.
Runs `sleep 100` in the background, then lists information specifically for that job (job number 1).