Created
September 29, 2011 18:10
-
-
Save brunogama/1251469 to your computer and use it in GitHub Desktop.
kill stuff like a boss
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
# Kill it Like a Boss | |
function vaporize { | |
QSTRING=$* | |
PROC=`ps aux | grep ${QSTRING} | grep -v grep | awk '{print $2}'` | |
if [ ! -n "$PROC" ]; then | |
echo "0 PID found with the matching String: \"${QSTRING}\"." | |
else | |
NUMPROC=`echo $PROC | awk '{print NF}'` | |
echo "Found $NUMPROC PIDs with the matching String: \"${QSTRING}\"." | |
sudo kill -9 $PROC | |
echo "All process Killed." | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment