Job Control

Unix allows you to suspend a program you are running and then go back to it later on. This is called "job control". When you are using a program interactively, it is said to be in the "foreground"; once it is stopped (with [CTRL-Z]) it is in the "background". At this point you can put the job back into the foreground by typing "fg", or tell it to continue to run in the background with "bg". The shell gives a number to each job that is running in the background or that has been stopped. To see the list of current jobs, type "jobs". Each job will be listed, preceded by its number. The job most recently stopped is referred to as the current job and will have a + sign in front of it. You can kill a job by typing: where n is the number of the job. A job left running in the background will stop when it needs input from the terminal. If you have trouble logging out because of "stopped jobs", see the section on the "There are stopped jobs." error.

Click here to go to the next section.

Or click here to go to the top of the chapter.