Section 6.8. Job Control


6.8. Job Control

Job control lets you place foreground jobs in the background, bring background jobs to the foreground, or suspend (temporarily stop) running jobs. All modern Unix systems, including Linux and BSD systems, support job control; thus the job-control features are automatically enabled. 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.

Both shells provide the following job-control commands. For more information on these commands, see the Built-in Commands (Bash and Korn Shells)," 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.


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.)



Linux in a Nutshell
Linux in a Nutshell
ISBN: 0596154488
EAN: 2147483647
Year: 2004
Pages: 147

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net