^C
Control-C will send an interrupt to the current program. Most programs will
immediately exit when this signal is received, some will ignore it, or will
delay before acting. Generally, this is the best way to stop a program that
needs to be stopped.
^D
Control-D sends the End-Of-Text (EOT) signal to a program. Many programs
dealing with keyboard input will terminate when this signal is used.
^Z
Control-Z instructs the operating system to immediately halt execution
of a program. A halted program will not terminate, or resume, but will
sit idle until dealt with. If you attempt to logout with a stopped
program, you may be warned of a stopped job; attempting to logout again
may force the job to terminate.
fg
ForeGround is the easiest way to resume a program. Uses are:
fg Restart most recently halted job
fg %1 Restart job #1
fg %3 Restart job #3 (see 'jobs' command)
bg
BackGround will resume a program at a lower priority, and allows
the user to do other things at the same time (i.e. it does not
interact with the user, so they can go run other programs).
A program in the background will run until finished, or it will halt
if it expects input. A program in the background can be brought to
the foreground, even when running, with the 'fg' command. Uses are
the same as for fg.
kill
Kill often causes a program to immediately terminate. Most (95%) programs
will die gracefully, while some may be stubborn. It sends an interrupt
(^C) by default, but can send other signals as well.
kill %1 Terminate job #1
kill %3 Terminate job #3
kill -9 <PID> Will kill even the most stubborn program. Note
that the Process ID number (PID) can be found
with 'ps'. Note that using this command to kill
your login shell will immediately log you out.
jobs
Will show a listing of all jobs, running or halted, such as:
[1] + Running mail
[2] - Stopped telnet
Note that the number in brackets [] is the index number that can be
used with 'fg', 'bg', and 'kill', as in 'fg %1'
&
Used to start a program in the background. For instance:
finger & Run 'finger' in the background
who & Run 'who' in the background
Note that these job control commands are very helpful in doing
several things at once, because they allow programs to run simultaneously
(one of the best features of UNIX).