I occasionally use the killall
command to kill processes. The reason why I say ocassionally is that in some cases it hasn't worked for me.
A recent example was with thunderbird where there were about 5 instances in memory so I decided to use the killall
command. It killed 2 processes and 3 were still left in memory. Tried again and the 3 were still there.
So I manually used the kill -9
command to kill each of the individual processes via their pids. That worked.
I mostly use the kill -9
command as it works. The killall
command has let me down so many times I just don't bother using it. But there must be a reason why it doesn't work. Am I using it wrong?
I know there are other commands like pkill
but I would be grateful to understand why the killall
command doesn't work as expected. I have even tried to kill just one process and it is a hit and miss affair. But the kill -9
command works every time.
Any ideas?
PS: sudo
doesn't make a difference
Best Answer
From the man page for killall
When you do a
kill -9
, you are sending the SIGKILL signal. If you want to send a SIGKILL with killall, you need to doA good explanation of the difference between SIGKILL and SIGTERM (and why you should try SIGTERM first)
From http://rackerhacker.com/2010/03/18/sigterm-vs-sigkill/
When you sent killall (SIGTERM) to the thunderbird processes, you requested those processes to stop. Some of those processes weren't working correctly (probably why you needed to kill them in the first place), so they couldn't act on the SIGTERM signal.