Job control (Unix)

For example, a command to select lines containing the text "title", sort these alphabetically, and display the result in a pager.

Job control was first implemented in the C shell by Jim Kulp,[4] then at IIASA in Austria, making use of features of the 4.1BSD kernel.

The POSIX standard specifies two commands for resuming suspended jobs in the background and foreground, respectively bg and fg.

Recall that a job corresponds to a process group, which consists of all the members of a pipeline and their descendants.

A job running in the foreground can be stopped by typing the suspend character (Ctrl-Z).

By default, SIGTSTP causes processes receiving it to stop, and control is returned to the shell.

In either case, the shell redirects I/O appropriately, and sends the SIGCONT signal to the process, which causes the operating system to resume its execution.

In Bash, a program can be started as a background job by appending an ampersand (&) to the command line; its output is directed to the terminal (potentially interleaved with other programs' output), but it cannot read from the terminal input.

A background process that attempts to read from or write to its controlling terminal is sent a SIGTTIN (for input) or SIGTTOU (for output) signal.