Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 632 Bytes

find-which-process-is-using-a-port.md

File metadata and controls

23 lines (16 loc) · 632 Bytes

Find Which Process Is Using A Port

Category: Mac

You can find which process and corresponding PID is using a port with lsof. For example, to find which process is using port 5173, run the following command:

lsof -i :5173

Sample output:

COMMAND     PID      USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
node      51305 gregsmith   28u  IPv4 0xf5b4dac0e3e80e91      0t0  TCP localhost:5173 (LISTEN)
node      51305 gregsmith   40u  IPv4 0xf5b4dac0e3edb3e1      0t0  TCP localhost:5173->localhost:54551 (ESTABLISHED)

To show all processes using ports locally:

lsof -i -P