UNIX Tip of the Week

Kill


Kill does much more than kill a process, though the first line of the man page might mislead. There are actually something like 30 different signals you can send to a process (use kill -l to list them).
The interesting ones are:

Name     Value

HUP      1
KILL     9
STOP     23
CONT     25
By default, kill sends signal 1, HUP (hangup) to the process you specify. Processes can trap this signal, though, and may not respond. Signal 9 (KILL) is not trapped, and will surely kill the process.
kill accepts either the name or the number as an option.


Killing the unkillable

$ ps aexf | grep netscape
22216 ?        S      0:11  \_ /usr/lib/netscape/netscape-communicator

$ kill 22216
$ ps aexf | grep netscape
22216 ?        S      0:11  \_ /usr/lib/netscape/netscape-communicator
It's still there! -Try
$ kill -KILL 22216
$ ps aexf | grep netscape
$

Putting a process on hold

So maybe things are getting a little slow, and you regret starting that day-long montecarlo a few hours ago. Still, you hate to lose what already ran... So put it on hold!
$ ps aexf | grep fullmonte
2753 ?        S      5:23  \_ /your/code/disk/fullmonte
$ kill -STOP 2753
This will stop your process, though it'll still be in memory, waiting to resume.

To start it up again, just kill -CONT 2753.


Revised: March 04, 2000