Linuxstar
Published on

jobs command-Display job information of the shell

Jonas

Jonas

1 min read

The jobs command is mainly used to display the list of tasks in the system and their running status.

This command can display the task number and its corresponding process number. The task number is from the perspective of ordinary users, and the process number is from the perspective of system administrators. A task can correspond to one or more process numbers.

Syntax: jobs [parameter] [directory]

Command parameters
-lInclude process number when displaying job list
-nDisplay the jobs whose status has changed since the last use of jobs
-pWhen displaying the job list, only the corresponding process number is displayed
-rShow only running jobs
-sShow only stopped jobs
Example

Display the current job list:

[root@linuxstar ~]# jobs 

Display the current job number and the corresponding process number:

[root@linuxstar ~]# jobs -l

Show only running jobs:

[root@linuxstar ~]# jobs -r

Show only suspended jobs:

[root@linuxstar ~]# jobs -s

Display the jobs whose status has changed since the last use of jobs:

[root@linuxstar ~]# jobs -n