Skip to content

Instantly share code, notes, and snippets.

@zumwalt
Created July 25, 2015 00:47
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 zumwalt/ec4962e79cd5b221461a to your computer and use it in GitHub Desktop.
Save zumwalt/ec4962e79cd5b221461a to your computer and use it in GitHub Desktop.
Find and kill a process using any port using a bash function
killport() {
lsof -i TCP:$1 | grep LISTEN | awk '{print $2}' | xargs kill -9
echo "Port" $1 "killed."
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment