To kill, stop, or continue processes, Linux uses a special form of
communication called "signals". By sending a certain signal to a process, you
can get it to terminate, stop, or do other things. This is what you're
actually doing when you type Control-C, Control-Z, or use the bg
or fg
built-ins -- you're using bash
to send a
particular signal to the process. These signals can also be sent using the
kill
command and specifying the pid (process id) on the
command line:
$ kill -s SIGSTOP 16224
$ jobs -l
[1]- 16217 Running xeyes -center red &
[2]+ 16224 Stopped (signal) xeyes -center blue
As you can see, kill
doesn't necessarily "kill" a process,
although it can. Using the "-s" option, kill can send any signal to a process.
Linux kills, stops, or continues processes when they are sent the SIGINT,
SIGSTOP, or SIGCONT signals, respectively. There are also other signals that
you can send to a process; some of these signals may be interpreted in an
application-dependent way. You can learn what signals a particular process
recognizes by looking at its man page and searching for a SIGNALS
section.