Linux 查看端口占用情况

lsof -i:port

例子:

lsof -i:3000
COMMAND   PID    USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
node     3385 grayson   24u  IPv4 0x3361f519169d57bf      0t0  TCP *:hbci (LISTEN)
node     3385 grayson  153u  IPv4 0x3361f5190449d7bf      0t0  TCP localhost:hbci->localhost:58359 (ESTABLISHED)
Electron 3457 grayson   44u  IPv4 0x3361f519060dcb3f      0t0  TCP localhost:58361->localhost:hbci (CLOSED)
Electron 3457 grayson   63u  IPv4 0x3361f519060dde3f      0t0  TCP localhost:58359->localhost:hbci (ESTABLISHED)

Comments