Created
July 9, 2013 11:14
-
-
Save SalvadorP/5956584 to your computer and use it in GitHub Desktop.
Shell script to kill all processes with a known name. An example can be creating two sleeping processes. In a terminal write sleep 1234 &. sleep 1234 &. And then ./mataprocesos.sh sleep. And it will kill al processes named with sleep. Can be copied to /bin/ and used like a normal shell command.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z "$1" ]; then | |
echo ERROR. Use ./mataprocesos.sh process_name | |
exit | |
fi | |
kill $(ps -cef | grep $1 | awk '{print $2}') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment