Skip to content

Instantly share code, notes, and snippets.

@brunogama
Created September 29, 2011 18:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brunogama/1251469 to your computer and use it in GitHub Desktop.
Save brunogama/1251469 to your computer and use it in GitHub Desktop.
kill stuff like a boss
# 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