If the monitor option of the built-in set command is turned on (set -m), an interactive POSIX shell associates a job with each pipeline. It maintains a table of current jobs, which you can written to standard output with the built-in jobs command, and assigns them small integer numbers. When a job is started asynchronously with &, the shell prints a line of the form:
[1] 1234
indicating that the job which was started asynchronously was job number 1 and had one (top-level) process, whose process ID was 1234.
If you want to start other processes while an existing process is being executed then you simply need to press the key combination CTRL+Z (or @@z at block-mode terminals). This causes a STOP signal to be sent to the process which is currently running. The POSIX shell then indicates that the job has been stopped and issues a prompt. You may then modify the status of this job: you can use the built-in command bg (background) to run the job in background mode, leave it stopped while you execute other commands or retrieve it to the foreground using the built-in command fg (foreground).
CTRL+Z (or @@z) has no effect on built-in commands, but only on commands which are executed in a forked process.
There are several ways to reference jobs in the shell. A job can be referenced by the process ID of any process or by one of the following expressions:
%number
the job with the given job number.
%string
any job whose command line begins with string.
%?string
any job whose command line includes string.
%%
the current job.
%+
equivalent to %%
%-
the previous job.
The POSIX shell registers changes in the status of jobs immediately. It normally informs you whenever a job becomes blocked so that no further progress is possible, but only just before it prints a prompt. This is done so that it does not otherwise disturb your work.
When the monitor option is turned on, each background job that completes triggers any trap set for CHLD.
If you try to exit the POSIX shell while jobs are running in the background or stopped, you will be warned with a message.
You may then use the jobs command to obtain an overview of the current situation. If you do this or immediately try to exit again, the shell will not warn you a second time, and the stopped jobs will be terminated.