Displays status of jobs in the current session.
jobs [ -l | -n | -p ] [ JobID ... ]
The jobs command displays the status of jobs started in the current shell environment. If no specific job is specified with the JobID parameter, status information for all active jobs is displayed. If a job termination is reported, the shell removes that job's process ID from the list of those known by the current shell environment.
The /usr/bin/jobs command does not work when operating in its own command execution environment, because that environment does not have applicable jobs to manipulate. For this reason, the jobs command is implemented as a Korn shell or POSIX shell regular built-in command.
If the -p flag is specified, output consists of one line for each process ID. If no flags are specified, standard output is a series of lines with the following fields:
If the -l flag is specified, a field containing the process group ID is inserted before the state field. Also, more processes in a process group may be output on separate lines, using only the job-number and command fields.
-l | (lowercase L) Provides more information about each job listed. This information includes the job number, current job, process group ID, state, and the command that initiated the job. |
-n | Displays only jobs that have stopped or exited since last notified. |
-p | Displays the process IDs for the process group leaders for the selected jobs. |
By default the jobs command displays the status of all stopped jobs, all running background jobs, and all jobs whose status has changed but not been reported by the shell.
The following exit values are returned:
0 | Successful completion. |
>0 | An error occurred. |
jobs -lThe screen displays a report similar to the following output:
+[4] 139 Running CC - C foo c& -[3] 465 Stopped mail morris [2] 687 Done(1) foo.bar&
job -p %mUsing the jobs reported in Example 1, the screen displays the following process ID:
465
/usr/bin/ksh | Contains the Korn shell jobs built-in command. |
/usr/bin/jobs | Contains the jobs command. |
The bg command,csh command, fg command, kill command, ksh command, wait command.