Skip to content

Instantly share code, notes, and snippets.

@JanMalch
Created November 23, 2021 20:49
Show Gist options
  • Save JanMalch/f45f2c447a303f253eafdffb60680b00 to your computer and use it in GitHub Desktop.
Save JanMalch/f45f2c447a303f253eafdffb60680b00 to your computer and use it in GitHub Desktop.
Kill process by specifying the port it's listening to
# usage: killport 8080
killport(){
netstat -lpn | grep ":$1\b" | awk '{sub(/\/.*/, "", $NF); print $NF}' | xargs -i kill -9 {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment