jobs
[-l]
List the active jobs under
job control. See job control commands.
The -l option lists process
IDs, in addition to the normal information.
The shell associates a numbered
job with each command sequence to keep track of those commands that are
running in the background or have been stopped with TSTP signals (typically
CTRL-z). When a command or command sequence (semicolon separated list)
is started in the background using the & metacharacter, the shell displays
a line with the job number in brackets and a list of associated process
numbers:
[1] 1234
To see the current list of jobs,
use the jobs built-in command. The job most recently stopped (or put into
the back-ground if none are stopped) is referred to as the current job
and is indicated with a ‘+’.
The previous job is indicated
with a ‘-‘; when the current job is terminated or moved to the foreground,
this job takes its place (becomes the new current job).
To manipulate jobs, refer
to the bg , fg , kill
, stop , and % built-in
commands.
A reference to a job begins
with a ‘%’. By itself, the percent-sign refers to the current job.
| Reference |
Description |
| %
%+ %% |
The
current job. |
| %minus; |
The
previous job. |
| %j |
Refer
to job j as in: ‘kill -9 %j’. j can be a job number, or a string that uniquely
specifies the command line by which it was started; ‘fg %vi’ might bring
a stopped vi job to the foreground, for instance. |
| %?string |
Specify
the job for which the command line uniquely contains string |
A job running in the background
stops when it attempts to read from the terminal. Background jobs can normally
produce output, but this can be suppressed using the ‘stty tostop’ command.
|