May 12, 2003
Kill signals

Scott is happily using linux on the desktop now... which is great. Everyone should do that.. Particularly those without any grey hair -- RedHat can take care of that problem quickly!

His entry from today brought out one of my minor linux-user-related pet-peeves. (One of very, very many, I assure you, but I don't really have the time nor the inclination to iterate through that list today.. not to mention I don't really mean to bore my readers to tears).

I'm sure everyone (really, I'm sure) who uses linux (unix, etc) on semi-regular or even occasional basis has used the

kill -9

.. command. You have? Stop it!

No, really.. it's bad. 9 is probably the most mis-used over-used and abused kill signal of them all.. Browser hangs? Kill -9 it, right! See? It's even a verb.

Why is it bad? Its translation into human language is essentially "kill with extreme prejudice".. which nine out of ten times is actually not necessary at all and a simple

kill -TERM

would suffice so the poor, abused application can do any post-processing it may need before moving into the underworld.. Using -TERM (or really just kill as it's the same thing) allows the program to do anything it needs before going away.. like cleaning up temporary files, removing stale file locks and other nastiness that can be avoided.

So repeat after me.. -9 bad.. TERM good.

Posted May 12, 2003 07:32 PM in Geek Stuff
TrackBack URL for this entry: http://www.unix-girl.com/mt/mt-tb.cgi/701
Comments
On May 12, 2003 09:27 PM Scott added:

Grey hair? Is this in reference to age or the grey hair that forms as a result of using *indows? I know guys in their early 30's with grey hair :)

#
On May 12, 2003 09:51 PM Techie2000 added:

I have never used kill -9. Man pages rule...

#
On May 13, 2003 06:00 AM Darren added:

I have a hotkey combo bound to xkill.

If something locks up, I simply type ctrl-alt-x and my cursor turns into a crosshairs, then I just click on the offending window.
Very cool, and saves faffing about working out the name of the program.

Also, agree on kill -9. It's very rarely necessary.
About as annoying as when you see someone running make as root when installing stuff.

#
On May 13, 2003 06:09 AM pete added:

i've never used kill -9 but i do use kill (PID) after running ps. is this the same thing as 'kill -9'?

#
On May 13, 2003 07:49 AM kasia added:

Pete, kill w/o a signal defaults to kill -TERM.

Darren, not in the same league, but cute :)

#
On May 13, 2003 11:05 AM ron added:

Wouldn't it be "-9 bad -15 good"

#
On May 13, 2003 11:36 AM dave added:

Grey hair? I'm beginning to feel personally targetted by this web site...

#
On May 13, 2003 11:41 AM Steve Friedl added:

Kill -1 (HUP) is also a good choice: this simulates a hangup, and lots of software is designed to deal with the case of an entire login session disappearing. Try HUP first.

#
On May 13, 2003 03:01 PM Jeremy aka bad-magic-number added:

Yeah, kill -9 can have nasty consequences... Like getting the PID wrong and putting "kill -9 1"...

#
On May 15, 2003 02:51 PM Baba added:

I use kill -9 *only* if sending a TERM doesn't work.

#
On May 17, 2003 12:54 PM Rick Gillette added:

KILLER! A true UNIX Geek would know you never NEVER hit anything harder then it takes to get the job done! Kill -HUP usually gets rid of the smaller junk. GreatBLOG! :)

#
On May 19, 2003 12:13 AM goneaway added:

Yeah, why bother with kill -9 on a single process when you can just kill init and dispense with the pretense of neatly ending a process with a sledgehammer.

BTW, killing single processes when you know what the problematic app is can be much simpler:

ps aux | grep problematic_app

then you can nail 'em all in a single line afterward. Grep is not the fastest thing in the world but it can be your friend.

#
On May 19, 2003 12:30 AM PK added:

Kill -9 means never having to check to see what you wanted to die actually did so. Call me lazy, or untrusting... but after a dozen or more years of dealing with in *nix, those extra ps -ef/aux | greps add up. I'd rather get an extra night of sleep before I die.

#
On May 19, 2003 10:40 PM Rick Gillette added:

Nyuk nyuk... I can't believe you have not lived long enough yet to find a process you could not kill even with a -9.. Uhhh.. you bettah check anyhoos... Doncha luv thems!

ipcs! ;)

#
Trackbacks
Team Murder:Things To Cross Off The To Do List
Skimming a few weblogs I haven't read in a little while and finding too much good stuff: Kasia has a
(read more)
May 19, 2003 12:42 AM