Skip to content

Instantly share code, notes, and snippets.

@sarogers
Created April 5, 2012 00:37
Show Gist options
  • Save sarogers/2306906 to your computer and use it in GitHub Desktop.
Save sarogers/2306906 to your computer and use it in GitHub Desktop.
ps | grep /term/ and kill matched lines
#!/bin/bash
PIDS=$(ps | grep $1 | awk '{print $1}')
echo PIDS: $PIDS
for p in $PIDS
do
echo Killing pid $p
kill -9 $p
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment