Killing a process
Sometimes applications crash, or at least they don’t behave the way they should. The kill command will come in handy when you need to kill an application. I use this command to find the Distiller pid then kill it:
kill -9 $(ps -auxwww | grep Distiller | grep -v grep | awk ‘{print $2}’)
One of the cool things I discovered to test a kill is to crash your application manually. If you lookup the pid (ps -aux) to the application you are trying to test, then issue a kill -STOP <pid> you will suspend the application.
I was having Distiller hang up problems, so I wrote a script to check if it was hung up. If it was then I would issue the kill -9 command to it. In order to test my script to see if it was working, I would issue the kill -STOP command to hang up the process.
November 26th, 2005 at 5:30 am
kill -9 is awfully harsh, that’s the take-no-prisoners method to forcibly quit an application in UNIX.
A nicer way is “kill -TERM [pid]“, which should work unless the process is totally hung and not responding to signals.
Also, you might want to check out the “killall” command, which kills processes by name.
For example, here’s how you can kill TextEdit if it’s open:
killall TextEdit