I have lost count of how many times I have had a rogue process I needed to kill by doing the following:
ps ax | grep foo
68105 ?? S 6:58.20 ladidadi foo ladida
kill -9 68105
Although this routine is quick to do, it is a bit annoying. I ended up with a little bash function that does this in a single neat command, and thought I’d share. Just put the following in your .bash_profile or similar.
nuke () { ps -ef | grep "$@" | grep -v grep | awk '{print $2}' | xargs kill -9; }
Now the same procedure as above is reduced to
nuke foo
Use wisely.