Build a Better Process

Linux jobs Command Summary with Examples

Linux jobs allows you to show jobs in the terminal.
  1. Purpose - Learn what jobs is for and how to find help.
  2. Options - Review a few common options and arguments.
  3. Examples - Walk through code examples with jobs.
  4. A tip - Finish off with one more insight.
face pic by Paul Alan Davis, CFA
Updated: February 24, 2021
In this tutorial on Linux jobs, 63 of 100, below find a 3-4 minute introductory video, a text-based tutorial and all of the code examples from the video.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / jobs-command.html

An ad-free and cookie-free website.

Examples of the Linux jobs Command


Learn to show jobs at the Linux command line.

Video Tutorial

Videos can also be accessed from the Linux Essentials Playlist on YouTube.

Linux jobs Command Summary with Examples (3:39)

Video Script

The Command and Why You Need It

Our sixty-third word, or command to memorize is jobs from our category System.

jobs allows you to show jobs in the terminal.

Common Linux jobs Options
-options description
-l Include process IDs
-r List only running jobs
-s List only stopped jobs

Recall from videos 45, 59 and 60 on ps, kill and bg, we saw jobs on the system, and here we'll see jobs local to this terminal session.

Before we start, it helps to think of commands as mini programs and most follow this structure: command -option(s) argument(s).

The jobs command has 5 options and the argument is the job.

Unlike most commands, help is not available with double-dash --help as jobs is a shell built-in (builtin) on most Linux distributions. Again, you can find details on job control in the exhaustive man page on bash.

The -l option includes process IDs, just as with the ps command. Use -r for running jobs and -s for stopped jobs only.

So why is jobs an important command? Well, you might be only concerned with finding what you're doing in your terminal session and not the whole system. And now you know how to do that.


Okay, the best way to embed this in your memory is by typing in your own terminal window.

Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.

Here we go. So maybe on your end the jobs command looks like this.

$ jobs $ _

Nothing. Wondering if it's your system, you try whatis and get this.

$ whatis jobs jobs: nothing apropriate

Don't despair, it's there, and type says that it's a shell builtin.

$ type jobs jobs is a shell builtin

So it works, but no local terminal jobs are present, so we'll create a sleep job for 5 minutes, like this.

$ sleep 5m & [1] 303

And then now, jobs shows the job.

$ jobs [1]+ Running sleep 5m &

We can add the Process ID (PID) number with -l.

$ jobs -l [1]+ 303 Running sleep 5m &

Or -r for running.

$ jobs -r [1]+ Running sleep 5m &

But a -s only show stopped jobs.

$ jobs -s $ _

And last, let's bring the job to the foreground with fg %1.

$ fg %1 sleep 5m _

Then stop it with Ctrl-z.

$ fg %1 sleep 5m ^Z [1]+ Stopped sleep 5m

And then run a jobs -s.

$ fg %1 sleep 5m ^Z [1]+ Stopped sleep 5m

And there it is, stopped. Very good.

A Final Tip

Okay now you know how to use jobs. And you know the syntax for commands, options and arguments.

One last tip about the jobs command. So if that fg command is new to you, we didn't have a separate video (tutorial) on it, but did mention it in video 60. If you want to check that out.

Okay, thanks for visiting today. I hope this was a helpful introduction to the jobs command.

Learn More About The Series

For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:

What's Next?

Our YouTube Channel is about learning faster, subscribe there and @factorpad on Twitter for reminders of new content.

Outline Back Tip Next

/ factorpad.com / tech / linux-essentials / jobs-command.html

linux jobs command
linux jobs examples
jobs linux
job control
linux job control
jobs command
linux stopped jobs
jobs command linux
linux jobs running
fg jobs
man jobs linux
bg jobs
shell jobs
ctrl z linux
linux jobs tutorial
process ID
linux jobs examples

A newly-updated free resource. Connect and refer a friend today.