Understanding the jobs Command

Basic Usage of jobs

The jobs command is used to display the status of jobs that are running in the background or suspended in the current shell session. It helps users keep track of their jobs and manage them effectively.

jobs [OPTIONS]

Options Available with jobs

-l (Long Format)

Display jobs in long format, including their process IDs (PIDs):

jobs -l

-n (Notify)

Display only jobs that have changed status since the last time jobs was called:

jobs -n

-p (Process IDs)

Print the process IDs of the jobs:

jobs -p

Examples of jobs Command

View All Jobs

jobs

This command lists all current jobs in the shell session.

View Jobs in Long Format

jobs -l

This command shows all current jobs along with their PIDs.

Check Only Changed Jobs

jobs -n

This command displays only jobs that have changed status since the last check.

Job Status

The output of the jobs command typically includes the following statuses:

Summary of Options

Option Description
-l Display jobs in long format, including process IDs.
-n Display only jobs that have changed status since last check.
-p Print only the process IDs of the jobs.