Created
December 1, 2016 21:10
-
-
Save tylrd/01585bb6a62c230321ad2bfb2143127d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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