Skip to content

Instantly share code, notes, and snippets.

@ivanacostarubio
Created January 22, 2014 21:47
Show Gist options
  • Select an option

  • Save ivanacostarubio/8568018 to your computer and use it in GitHub Desktop.

Select an option

Save ivanacostarubio/8568018 to your computer and use it in GitHub Desktop.
A bash script to kill process that uses certain port.
#
# Usage: sh kill_port.sh p
# where p is a port like 3000 (rails), 9393 (shotgun), etc.
# enjoy
#
kill -9 `lsof -w -n -i tcp:$1 | awk '$2!="PID" {print $2;}'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment