Bash tip: How to stop many processes in with a small script

Task:
Kill many processes with same name. If your program use a lot fork(), It will generate many same name process. 

How to do this:


#!/bin/bash
s=$( ps aux|grep |head -n -1|cut -d ' ' -f 2-3)
for foo in $s
do
        echo "kill " $foo
        kill $foo
done

save it and change the application name

你可能感兴趣的:(bash,application,kill)