Chapter 15. Job Control

In This chapter:

  • Job States

  • Obtaining Job Information

  • Changing a Job's State

  • Other Applications of Job Control

  • Job Control and Window Systems

Each command you issue starts what the shell calls a job. The shell keeps track of all jobs that have not terminated and provides facilities to manipulate those jobs. As a result, you have a lot of control over the execution of your commands. Job control has many uses:

  • You can stop a job to suspend it, then resume the job at a later time. If you are composing a mail message and find that you need to check some files before proceeding, you can suspend the mailer, run a bunch of commands, and then resume the mailer where you left off. If you are using gopher and you see an announcement about an interesting mailing list, you don't have to quit gopher to sign up; instead, you can suspend gopher, send a mail message to join the list, and then resume gopher where you left off.

  • Some programs provide an escape mechanism for passing single commands to a subshell for execution. Job control provides a more convenient alternative when you want to run several commands in a row. It's easier to stop the editor and restart it later than to type the escape prefix multiple times. The former method is faster because you are not starting up a separate subshell to handle each command. Additionally, you get to use filename completion and the history of your login shell, facilities which are unavailable to commands that run as shell escapes.

  • You ...

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.