Go to the first, previous, next, last section, table of contents.
The shell can do more to a process than simply initiating its execution. It can also terminate a process prematurely or, on some systems, suspend a process to be resumed at a later time, resume a suspended process, and move a process between the foreground and background. This is known as job control.
In order for the user to instruct the shell to manipulate certain processes, the shell must provide names for the processes. For this purpose, the shell groups all the process involved in executing one task (usually a single process or a pipeline) together and gives that group (that task) a number - the task number. Further, all tasks generated by a particular job are grouped together and given a job number. Tasks are given unique numbers only within a given job, so the full name for a task is the job number of the containing job, together with the particular task number. These numbers are separated by a period. Often, a job will contain only one task, so the task number can be left off.
When a new job is created, it is allocated the number one more the the largest job number currently in use, so job numbers with usually be small (single digit) and get reused. Task numbers are allocated sequentially within a job.
The commands
fg, bg, kill, stop, notify, jobs, wait
are used to control and inspect jobs.
These commands can be followed by a job specifier, or with affect the
current job by default.
A job specifier is either a
These options are deliberately similar the options for selecting commands from the history.
Two of the commands,
wait
and
kill
can be given a process id rather than a job specifier. For these, a
job number must be distinguished from a process idby prefixing it with
a period.
As a special case, a command containing just one word which is an at
sign (@) follwed by a job specifier, is the same as the
fg
builtin given that job specifier.
Go to the first, previous, next, last section, table of contents.