Debian is a multitasking system, so you need a way to do more than one thing at once. Graphical environments like X provide a natural way to do this; they allow multiple windows on the screen at any one time. Naturally, bash (or any other shell) provides similar facilities.
Earlier you used top to look at the different processes on the system. Your shell provides some convenient ways to keep track of only those processes you've started from the command line. Each command line starts a job (also called a process group) to be carried out by the shell. A job can consist of a single process or a set of processes in a pipeline (more on pipelines later).
Entering a command line will start a job. Try typing man cp, and the cp manual page will appear on the screen. The shell will go into the background and return when you finish reading the manual page (or you can press q to quit rather than scrolling through the whole thing).
But say you're reading the manual page, and you want to do something else for a minute. No problem. Press Ctrl-z while you're reading to suspend the current foreground job and put the shell in the foreground. When you suspend a job, bash will first give you some information on it, followed by a shell prompt. You will see something like this on the screen:
[1]+ Stopped man cp
$
bash assigns a job number to each command line you run from the shell. This allows you to refer to the process easily. In this case, man cp is job number 1, displayed as [1]. The + means that this is the last job you had in the foreground. bash also tells you the current state of the job - Stopped - and the job's command line.
There are many things you can do with jobs. With man cp still suspended, try the following commands:
[1] Stopped man cp
[2]- Stopped man ls
[3]+ Stopped man mv
{$}
[1]- Terminated man cp
$
[1]- Killed man mv
$
In technical terms, kill simply sends a signal. By default, it sends a signal that requests termination (TERM, or signal 15) but you can also specify a signal, and signal 9 (KILL) is the signal that forces termination. The command name kill is not necessarily appropriate to the signal sent; for example, sending the TSTP (terminal stop) signal suspends the process but allows it to be continued later.
You may not be able to find your processes because they're off the bottom of the screen; if you're using X (see Chapter 9 on page ), you can resize the xterm to solve this problem.
Even these simple jobs actually consist of multiple processes, including the man process and the pager more, which handles scrolling one page at a time. You may notice the more processes are also visible in top.
You can probably figure out how to clean up the remaining two jobs. You can either kill them (with the kill command) or foreground each one (with fg) and exit it. Remember that the jobs command gives you a list of existing jobs and their status.
One final note: The documentation for bash is quite good, but it is found in the Info help system rather than the man pages. To read it, type info bash. See section A.1.1 for instructions on using the info program. bash also contains a very good summary of its commands accessible by the help command. help displays a list of available topics; more information about each of them is accessible with the command help topic name. Try typing help cd, for example. This will give you details on the -P and -L arguments recognized by cd.
John Goerzen / Ossama Othman