Last active
August 29, 2015 14:17
-
-
Save olivierrr/5115e6a1c47bc383242c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/bin/sh | |
if [ -z "$1" ]; then | |
echo "Usage: $0 <PORT>"; | |
return 1; | |
fi | |
PID=$(lsof -i :$1 | tr -s ' ' | cut -d ' ' -f 2 | sed -n 2p) | |
if [ -z "$PID" ]; then | |
echo "Can't find Process in that port"; | |
return 1; | |
else | |
kill -9 $PID; | |
echo "Done!"; | |
return 0; | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment