Skip to content

Instantly share code, notes, and snippets.

@rasgo-cc
Last active February 25, 2019 16:49
Show Gist options
  • Save rasgo-cc/1052d3e1a1bf8e88921430ec207cc406 to your computer and use it in GitHub Desktop.
Save rasgo-cc/1052d3e1a1bf8e88921430ec207cc406 to your computer and use it in GitHub Desktop.
Kill all processes running on port passed to killport (e.g. 'killport 8080')
# Add this to your .zshrc file (or equivalent)
# Kills all processes running on a given port
# Usage: killport <port>
function killport() {
lsof -i:$1 | grep LISTEN | awk '{print $2}' | xargs kill -9
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment