Skip to content

Instantly share code, notes, and snippets.

@scottshane
Last active August 18, 2020 02:43
Show Gist options
  • Save scottshane/7d01b6f494819e2aef6a57e85da941a0 to your computer and use it in GitHub Desktop.
Save scottshane/7d01b6f494819e2aef6a57e85da941a0 to your computer and use it in GitHub Desktop.
kill process by port number
killport () {
kill -HUP $(lsof -i :$1 | grep -v grep | tail -1 | awk '{print $2}')
echo Killed process on port $1
lsof -i :$1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment