Skip to content

Instantly share code, notes, and snippets.

@Fang-Li
Forked from xinthink/ekill
Created September 28, 2018 01:35
Show Gist options
  • Save Fang-Li/6d7828b4160e8ef5bcc2c9f6bda55c0a to your computer and use it in GitHub Desktop.
Save Fang-Li/6d7828b4160e8ef5bcc2c9f6bda55c0a 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