kill stubborn processes
January 17th, 2006 by Lawrence David
if you’re having difficulty killing recalcitrant jobs or programs, try this short but sweet script. note that this will even work for the mac; just use the terminal.app. i find this to be even faster than the apple-option-esc shortcut.
#!/bin/sh
#end recalcitrant processes
ID=$1
kill -9 `ps ax | grep -i “$ID” | awk ‘{print $1}’`
if you save it something like “slay.sh”, use it like:
slay.sh name-of-program
(mad props go to CWigs for inspiring this script)
Note that -9 is a violent kill to processes. It does not allow them to properly clean up after themselves. It should only be used as a last ditch effort to kill a process.
May want to consider making a script that uses somehow
ps -U username
then kill pid after matching the pid to the desired thing to kill….
but maybe the grepping and all that does just this??? so maybe
the caution is to try the command above with just kill and not the -9