Sometimes you’ll find a bunch of stale or malicious processes that need to be killed. When a killall won’t grab them, use this simple for loop to kill -9 each of them individually from the ps output. Simply replace the name= variable with the PID’s name or a string from the process list.
# name="perl"
# for i in $(ps afx|grep $name|awk {'print $1'}) ; do kill -9 $i ; done
The example above would kill all running processes that had the word “perl” in the command.
Tweet
Erik
Saturday, October 17, 2009
linux administration - tips, notes and projects
No Comment