Find process by port number

My tmux session crashed, including a local server instance I was running. Now when I try to restart the server I get an error saying it's still running? How do I kill it?

You probably already know what port you were using, so find what's listening on that port, collect it's PID and then kill it:

Find the PID of what's running on port 9292 using lsof:

→ lsof -i:9292 -t

Kill the process:

→ kill 58085

If there's a faster way to do this please let me know =)

Note: I work mainly on OSX and Linux. But I think the alternative on Windows is Handle

Leave a comment -