Skip to content

Instantly share code, notes, and snippets.

@tylrd
Created December 1, 2016 21:10
Show Gist options
  • Save tylrd/01585bb6a62c230321ad2bfb2143127d to your computer and use it in GitHub Desktop.
Save tylrd/01585bb6a62c230321ad2bfb2143127d to your computer and use it in GitHub Desktop.
function killp () {
if (( $# == 0 ))
then
echo usage: killp portNumber1 portNumber2 ...
else
for i;do
PROCESS=$(lsof -t -i:$i)
if [[ $PROCESS ]]; then
kill -9 $PROCESS
echo "killed process $PROCESS"
else
echo "No process found for port $i"
fi
done
fi;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment