Skip to content

Instantly share code, notes, and snippets.

@xinthink
Created April 2, 2013 08:17
Show Gist options
  • Save xinthink/5290714 to your computer and use it in GitHub Desktop.
Save xinthink/5290714 to your computer and use it in GitHub Desktop.
Kill process by match the whole command line (like ps -ef) Usage: ekill <pattern> [signal]
#!/bin/bash
SIG="-2"
if [[ "$2" != "" ]]; then
SIG="$2"
fi
ps -ef | grep $1 | grep -v grep | awk '{print $2}' | xargs kill $SIG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment