Killing Processes

Previously if I had wanted to kill a bulk list of mysql processes I would have done something like:

ps auxww | grep ^mysql | awk '{print $2}' | xarg kill -9

Today I discovered two really handy commands that make listing and killing processes a lot easier, pkill and pgrep.

You can achieve the same result as above with:

pkill -9 -u mysql mysql

This will kill all processes owned by the mysql user that have mysql in their name.

One thought on “Killing Processes”

  1. coool!! thx 4 tipp … sometimes it takes time, ’till someon needs this… but now, the time has come 😀

    cheers

Leave a Reply

Your email address will not be published. Required fields are marked *