Process Management

Each command you invoke or program that you run from a Terminal window becomes a child of that terminal’s shell. The Terminal window can juggle many child processes at once, but only one at a time is foregrounded, writing its output (through the Unix standard output file handle) to the Terminal, and accepting keyboard input (via Unix standard input) from the user. Any other processes are either backgrounded, running but not displaying any interface or accepting input, or suspended, paused in the process of execution.

You can control the foregrounded application by sending it Unix signals via the keystrokes listed in Table 19-1. Programs usually respond to them as listed, though individual programs may interpret them differently. (The Emacs text editor, for example, ties a text-searching function to the Control-S keystroke.)

Table 19-1. Foreground process control keystrokes

Keystroke

Description

Control-C

Sends an interrupt signal, which usually causes the program to exit.

Control-D

Sends an end-of-file signal. If a program is accepting multiple lines of input from you, this signals that you’re finished providing it.

Control-Z

Suspends the foregrounded process and returns you to the command line.

Control-S

Suspends the foregrounded process, but keeps it in the foreground.

Control-Q

Resumes a suspended, foregrounded process.

Tip

Control-Q is a good keystroke to try if a Terminal window ceases to update or accept input for no obvious reason, while other ...

Get Mac OS X in a Nutshell 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.