Skip to content

Instantly share code, notes, and snippets.

@zfael
Last active January 7, 2020 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zfael/144f452e0fcd54a86c3548b892e55792 to your computer and use it in GitHub Desktop.
Save zfael/144f452e0fcd54a86c3548b892e55792 to your computer and use it in GitHub Desktop.
shortcut to kill a specific port
# 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