The following attempts to kill based on a pattern you specify. I wrote this because our network gets messed up while Amarok is attempting to load files, which causes it to hang and leave various pipes open. By specifying “amarok” where it says “pattern”, below, I can kill all the open Amarok processes in one fell swoop.

ps ax | grep pattern | awk '{print $0; system("kill " $1) }'

Use with care — it doesn’t differentiate between partial names. So if you want to kill all processes with ‘mini’ and you just specify ‘ini’, you will also attempt to kill ‘init’ (though that shouldn’t work).

(Also: The process group flag for ‘killall’ should do this, but it doesn’t work for Amarok, on my system.)