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:
NAME cp - copy files SYNOPSIS cp [options] source
--More--
[1]+ Stopped man cp
$
Note the last two lines. The next to last is the job information,
and then you have a shell prompt.
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:
man ls
Starts a new job.