start page | rating of books | rating of authors | reviews | copyrights

UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: 4.5 Command HistoryChapter 4
The Bourne Shell and Korn Shell
Next: 4.7 Invoking the Shell
 

4.6 Job Control

Job control lets you place foreground jobs in the background, bring background jobs to the foreground, or suspend (temporarily stop) running jobs. Job control is enabled by any of the following commands:

jsh -i		Bourne shell

ksh -m -i		Korn shell (same as next two)
set -m
set -o monitor

Many job control commands take a jobID as an argument. This argument can be specified as follows:

%n

Job number n.

%s

Job whose command line starts with string s.

%?s

Job whose command line contains string s.

%%

Current job.

%+

Current job (same as above).

%-

Previous job.

The Bourne and Korn shells provide the following job control commands. For more information on these commands, see the section "Built-in Commands" later in this chapter.

bg

Put a job in the background.

fg

Put a job in the foreground.

jobs

List active jobs.

kill

Terminate a job.

stop

Suspend a background job.

stty tostop

Stop background jobs if they try to send output to the terminal. (Note that stty is not a built-in command.)

suspend

Suspend a job-control shell (such as one created by su).

wait

Wait for background jobs to finish.

CTRL-Z

Suspend a foreground job. Then use bg or fg. (Your terminal may use something other than CTRL-Z as the suspend character.)


Previous: 4.5 Command HistoryUNIX in a Nutshell: System V EditionNext: 4.7 Invoking the Shell
4.5 Command HistoryBook Index4.7 Invoking the Shell

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System