Skip to content

Instantly share code, notes, and snippets.

@ronisaha
Created June 17, 2014 10:07
Show Gist options
  • Select an option

  • Save ronisaha/6064f61890febf87a3d3 to your computer and use it in GitHub Desktop.

Select an option

Save ronisaha/6064f61890febf87a3d3 to your computer and use it in GitHub Desktop.
bash script - kills all pids matching the search term of "PROCESS".
#! /bin/bash
if [ 0 == $# ]; then
echo -n "Provide Process String:"
read PROCESS
else
PROCESS="$1"
fi
if [[ -z $PROCESS ]]; then
echo "No process string given"
else
ps aux | grep ${PROCESS} | grep -v grep | awk {'print$2'} | xargs kill -9
ps aux | grep ${PROCESS}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment