Created
December 28, 2016 06:31
-
-
Save dasegn/e306d681bb6fa8eddbf1586f909b094f to your computer and use it in GitHub Desktop.
Terminate programs by port via bash in Mac (via: https://blog.adriaan.io/mac-terminate-program-by-port.html)
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
# terminate function | |
terminate () { | |
lsof -i "tcp:$1" | tail -1 | awk '{print $2}' | xargs kill -9 && echo "Killed proces on port $1" || echo "Failed to kill proces on port $1" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment