UNIX is a multitasking operating system. Sure, but how does one run a number of programs? One answer: use the background process facility!
When typing command names and waiting for the output, the user is said to be in foreground mode: the user has to wait for the program/command to finish executing before typing the next one. But if the user types an ampersand (&) at the end of the command line, that particular command is executed in the background, and the command prompt immediately reappears, along with a process id number, called pid, as in:
prompt> latex bigfile.tex > tex.out &
[1] 1198
latex bigfile.tex displays messages onto the standard output. But, in this case, it has been redirected to tex.out. 1198 is the pid of the job.
Upon completion, the message
will be displayed on the screen.[1] Done latex bigfile.tex > tex.out
NOTE: if the terminal used is connected to a serial port on the UNIX system, then all background processes should be finished before logging out.
If, at logout time, there are still jobs running in background mode, then this could potentially hang the serial port the terminal is connected to.
In this case, batch (explained in a later chapter) should be used.