Find the PID of a process by specific port

November 14, 2017

You can use the lsof utility to find what process is using a port. For example, to see what process is using port 8000:

lsof -i :8000

You'll get something like this:

COMMAND  PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    2501  dan   54u  IPv4 0x[some numbers here]      0t0  TCP *:irdmi (LISTEN)

See this stack exchange question for more info.

Made it this far? Have a go at the game of snake