Skip to content

Instantly share code, notes, and snippets.

@dliv
Created February 12, 2017 20:27
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 dliv/04a7c1807962f28f75f36fee8457815a to your computer and use it in GitHub Desktop.
Save dliv/04a7c1807962f28f75f36fee8457815a to your computer and use it in GitHub Desktop.

Kill Process Using Port

Tested on mac.

Nuclear

Assuming you know the command name, own the process, and want to kill them all.

$ killall node

Specific Process

Based on: http://stackoverflow.com/questions/3855127

Find PID from port (e.g. 5000)

$ lsof -i tcp:5000

COMMAND   PID            USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
node    82240 davidlivingston   11u  IPv6 0x136079696e382719      0t0  TCP *:commplex-main (LISTEN)

Kill PID (e.g. 82240)

$ kill 82240

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