🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

jobs Command

Intermediate Process Management man(1)

Display status of background jobs in current shell

👁 9 views 📅 Updated: Mar 16, 2026
SYNTAX
jobs [OPTION]... [JOB_SPEC]

What Does jobs Do?

The jobs command displays the status of background and suspended jobs in the current shell session. Each job has a job number (different from PID) that can be used with fg, bg, kill, and other job control commands.

jobs shows whether each background task is running, stopped, or completed. It is a shell built-in available in bash, zsh, and other Bourne-compatible shells.

Job control is essential for multitasking in a single terminal — running commands in the background, switching between tasks, and managing multiple processes without needing multiple terminal windows.

Options & Flags

OptionDescriptionExample
-l List jobs with PIDs jobs -l
-r Show only running jobs jobs -r
-s Show only stopped jobs jobs -s
-p Show only PIDs jobs -p

Practical Examples

#1 List all jobs

Shows all background and suspended jobs in the current shell.
$ jobs
Output: [1]+ Running ./backup.sh &\n[2]- Stopped vim config.yml

#2 List with PIDs

Shows job numbers along with process IDs.
$ jobs -l
Output: [1]+ 12345 Running ./backup.sh &

#3 Background a task

Starts a background job and lists it.
$ sleep 300 &\njobs
Output: [1]+ Running sleep 300 &

#4 Resume stopped job

Brings job 1 back to foreground.
$ fg %1

#5 Show only running jobs

Lists only jobs that are currently running.
$ jobs -r

#6 Kill a job by number

Sends SIGTERM to job number 1.
$ kill %1

Tips & Best Practices

Job control shortcuts: Ctrl+Z suspends foreground process. bg resumes it in background. fg brings it to foreground. & at end of command starts in background.
Job numbers vs PIDs: %1 refers to job 1, $! refers to the last background PID. Use jobs -l to see both job numbers and PIDs.
Jobs are per-shell: jobs only shows jobs from the current shell session. Background jobs started in other terminals are not visible.

Frequently Asked Questions

How do I put a process in the background?
Press Ctrl+Z to suspend it, then type bg to resume it in the background. Or start it with & at the end: command &
How do I bring a background process to the foreground?
Use fg %N where N is the job number from jobs output. Just fg brings the most recent job.
What happens to background jobs when I log out?
By default, background jobs receive SIGHUP and terminate. Use nohup command & or disown to keep them running.

Master Linux with Professional eBooks

Curated IT eBooks covering Linux, DevOps, Cloud, and more

Browse Books →