Last active
January 7, 2020 18:46
-
-
Save zfael/144f452e0fcd54a86c3548b892e55792 to your computer and use it in GitHub Desktop.
shortcut to kill a specific port
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
# Usage | |
# 1 - add below snippet on your bashrc/zshrc | |
# 2 - call it by "killport 4000" | |
# 3 - profit | |
killport() { | |
port=$(lsof -n -i4TCP:$1 | grep LISTEN | awk '{ print $2 }') | |
kill -9 $port | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment