Job Control
Job control lets you place foreground jobs in the background, bring background jobs to the foreground, or suspend (temporarily stop) running jobs. 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 following job-control commands are described more completely in the section Built-in Commands in Built-in Commands.
- 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.)
Get Linux in a Nutshell, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.