Killing Processes by Name with pkill
I decided that in the end, even though I’ve neglected my little blog here for so long, I shouldn’t be ashamed if the first post a put in a while is a technical one. So here goes:
If you want to kill one or many processes that all involve the same command or similar command, you can do it with the handy unix command pkill. It will kill all processes containing the string you give it as an argument. Use the -u option to restrict it to a particular user. For instance:
to kill all processes with ‘java’ in their name started by user ‘joeuser’.
Another related handy command is pgrep which only lists the process id’s of matching processes and doesn’t actually kill them.