#!/bin/bash
ps -ef | grep $1 | awk '{print $2}' | while read pid; do kill -15 $pid; done
Save the script as wildkill.sh, make it executable:
chmod 755 wildkill.sh
and run it like this:
./wildkill.sh firefox
This will kill any process that contains the name firefox...be sure you know what you're killing because this script can be wild!
Yeee-Haaah!
I love what goes on in that crazy head of your sometimes ;) Craaazzzy Jake!!
ReplyDeleteCool script ;) How about you extend it to have it randomly choose binaries from /usr/bin and /usr/sbin and pass that as an argument to grep (instead of $1 - your script argument). Name that one something like, oh I dont't know...goinPostal.sh..?
ReplyDeleteI can hear the black unmarked roflcopters flying above :)
ReplyDeleteI've always been a fan of these:
:() { :|: }; :
OR
sudo kill -9 -1
We could call the first one fork_urself.sh and the next one junk_punch.sh...I like it. :)