>Usage
jobs is a command which lists all current jobs associated with the terminal, displaying their job IDs and status (running, stopped, etc.). Each job represents a process started in the shell, and the jobs command helps users monitor and manage these processes.
>Synopsis
>Options
[JOB]
Lists all current jobs started by the current shell with their job IDs and statuses ([JOB] is the job ID, which corresponds to a name or a number).
Example 1:
-zsh
> jobs
[1]- Running sleep 30 &
[2]+ Stopped sleep 45 &
-l
Shows process IDs with additional information such as the state and the command that initiated the job. The PID of each job can be useful for managing or debugging specific processes.
Example 2:
-zsh
> jobs -l
[1]- 5713 Running sleep 30 &
[2]+ 5714 Stopped sleep 45 &
-n
Shows only the jobs in the current shell session that have had a status change since the last update. This tool is especially helpful for keeping track of job statuses without overwhelming the output with jobs that haven't been altered.
Example 3:
-zsh
> jobs -n
[2]+ Stopped sleep 45 &
-p
Lists only process IDs of the current jobs, without additional information. This is super handy when you need to identify the PIDs of background or paused jobs, especially if you want to manage them further, like using the kill command to end specific jobs.
Example 4:
-zsh
> jobs -p
5713
5714
-r
Shows only running jobs. This excludes any jobs that are stopped or have completed, allowing you to see only actively running jobs.
Example 5:
-zsh
> jobs -r
[1]- Running sleep 30 &
-s
Shows only stopped or suspended jobs. This excludes running jobs and shows only those that have been paused, usually by a signal like Ctrl+Z.
Example 6:
-zsh
> jobs -s
[2]+ Stopped sleep 45 &