Leif160519的blog Leif160519的blog

——————

目录
linux下查看某一端口被哪个进程占用(mac也同样适用)
/  

linux下查看某一端口被哪个进程占用(mac也同样适用)

方法1:lsof命令

lsof -i:端口号

例如:

root@linux:~# lsof -i:1884
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
beam.smp 992 root   28u  IPv4  26833      0t0  TCP *:1884 (LISTEN)

方法2: netstat命令

netstat -tunpl | grep 端口号

例如:

root@linux:~# netstat -tunpl | grep 1884
tcp        0      0 0.0.0.0:1884            0.0.0.0:*               LISTEN      992/beam.smp

“The first 90% of the code accounts for the first 90% of the development time. The remaining 10% of the code accounts for the other 90% of the development time.” – Tom Cargill

标  题linux下查看某一端口被哪个进程占用(mac也同样适用)
作  者Leif160519
出  处https://github.icu/articles/2019/09/06/1567762597281.html
关于博主:坐标南京,运维工程师,如有问题探讨可以直接下方留言。
声援博主:如果您觉得文章对您有帮助,可以评论、订阅、收藏。您的鼓励是博主的最大动力!