Background Processing

The shell allows you to start a command and then launch it into the background as a process by using an ampersand (&) at the end of a command line. This technique is often used at the command line of an X terminal window to start a client and return to the command line. For example, to launch another terminal window using the xterm client,

The numbers echoed back show a number (3 in this example), which is a job number, or reference number for a shell process, and a Process ID number, or PID (1437 in this example). The xterm window session can be killed by using the shell's built-in kill command, along with the job number like this:

Or the process can be killed by using the kill command, along with the PID, like so:

$ kill 1437

Background processing can be used in shell scripts to start commands that take a long time, such as backups:

4 PREV

Was this article helpful?

0 0

Post a comment