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, you can use the following:

matthew@seymour:~$ xterm &[3] 1437

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). You can kill the xterm window session by using the shell’s built-in kill command, along with the job number like this:

matthew@seymour:~$ kill %3

Get Ubuntu Unleashed 2015 Edition: Covering 14.10 and 15.04, Tenth 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.