Job Control
Job control allows you to suspend or terminate jobs, or move jobs between the foreground and background. Job control commands are shown below. When used, %
j
indicates the job of interest.
Command | Description |
---|---|
| Stop the foreground job |
| Interrupt (terminate) foreground job |
| Bring stopped or background job to foreground |
| Move stopped job to background |
| Kill (terminate) stopped or background job |
| Stop background job |
| Suspend current shell (if non-login shell) |
| Display current job list |
The job specifier %
j
has the following forms.
Specifier | Description |
---|---|
| Current job ( |
| Previous job |
| Job number |
| Job whose command line begins with |
| Job whose command line contains |
The fg and bg commands have the shorthand forms listed below.
Specifier | Description |
---|---|
| Equivalent to |
| Equivalent to |
| Equivalent to |
| Equivalent to |
If the notify shell variable is set, the shell notifies you immediately when background jobs finish. Otherwise, notification occurs when the next prompt is printed.
Use stty to specify whether or not background jobs can write to your terminal, as shown below:
stty tostop Force background jobs to stop when ready to write to terminal stty -tostop Allow background jobs to write to terminal
Get Using csh & tcsh 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.