Sometime when we found a lot of process associates with a software or something that may hurt our memory or CPU, and it would be nice to kill that all process and be our system in a fine position. But when there is so many process we can’t kill all the process by hand using the command
$ kill -9 PID
where ‘PID’ is the process id.
Shell commands will help us to do this. See below
First you create a .sh file file named ‘killAllProcess.sh’.
#!/bin/bash echo "Usage : ./killAllProcess.sh " for i in `ps ax | grep $1 | grep -v grep | sed 's/ *//' | sed 's/[^0-9].*//'` do kill -9 $i done echo "Killed All the process which has name with $1"
And make this file executable
$ chmod +x killAllProcess.sh
Then run it
$ ./killAllProcess.sh
And see any process with that name is there
$ ps aux | grep PROCESS_NAME
All vanishes..!!