详细内容
当前位置 首页 >> 技术文档 >> linux >> 正文
linux查看端口被哪个进程占用的方法
发布日期:2021-11-12     点击:881     字体:[ ]

1.通过lsof -i: 命令可以看到这个进程的pid,例如查看3000端口

lsof -i:3000

COMMAND   PID   USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME

node    37543 hadoop   19u  IPv6 570021526      0t0  TCP *:3000 (LISTEN)

2.查询该PID对应的进程

ps -aux |grep 37543

输出如下:

hadoop    37543  0.3  3.5 975100 143792 ?       Ssl  Nov11   4:24 node /home/hadoop/kims/kims-nest/dist/main.js

hadoop    56422  0.0  0.0  13136  1008 pts/1    S+   15:03   0:00 grep --color=auto 37543


这样就能看出3000端口是被/home/hadoop/kims/kims-nest/dist/main.js启动文件占用的。


用户评论
昵称 
内容  *
验证码   
   
Copyright © 2010 zdbase.com All Rights Reserved. 苏ICP备15039389号 可人软件设计