Tuesday, September 11, 2012

How to kill multiple processes with name pattern

Say, you need to kill multiple processes in linux which comply with some string pattern. here is the command which can help you:

ps x | grep Admin | awk '{print "kill -9 " $1}' | bash

I usually test it without "bash" first, so you can see what will be killed:

ps x | grep Admin | awk '{print "kill -9 " $1}' 

Note that all processes with "Admin" will be killed after the invocation of this command.

No comments:

Post a Comment