Skip to content

Instantly share code, notes, and snippets.

@ultim8k
Created September 16, 2019 11:07
Show Gist options
  • Save ultim8k/da3ffdd3dd35636b1858f9366971ffe6 to your computer and use it in GitHub Desktop.
Save ultim8k/da3ffdd3dd35636b1858f9366971ffe6 to your computer and use it in GitHub Desktop.
Killing process that listens to a specific port

Killing process that listens to a specific port

Find the process that listens on a port

Copied from: stackoverflow

Our example port is 3000. Replace it with the port number you need.

# On linux
netstat -vanp tcp | grep 3000
# On Centos
netstat -vanp --tcp | grep 3000
# On OSX El Capitan+ (or if your netstat doesn't support -p)
sudo lsof -i tcp:3000

Kill the process

Our example process id (PID) is 35642. Replace it with the process id you find from the previous command.

sudo killall 35642
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment