Linux根据端口号查看进程PID分享


%ignore_a_1%根据端口号查看进程的pid。

1、命令lsof,以查找占用端口80为例,用法如下:

 [root@localhost sbin]# lsof -i:80 COMMAND  PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME nginx   8246   root    6u  IPv4  64233      0t0  TCP *:http (LISTEN) nginx   8247 nobody    6u  IPv4  64233      0t0  TCP *:http (LISTEN)

以上为进程ID为8246和8247的nginx应用,占用80端口

2、命令netstat,以查找占用80端口为例,用法如下:

 [root@localhost sbin]# netstat -nlp|grep :80 tcp        0    0 0.0.0.0:80    0.0.0.0:*    LISTEN        8246/nginx

然后可以通过命令ps,可以查看已知进程PID的执行目录的详细信息

 [root@localhost sbin]# ps -ef | grep 8246 root       8246      1  0 14:56 ?        00:00:00 nginx: master process ./nginx nobody     8247   8246  0 14:56 ?        00:00:00 nginx: worker process root       8461   2679  0 15:26 pts/1    00:00:00 grep 8246
 [root@localhost sbin]# ps -x | grep 8246   Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ   8246 ?        Ss     0:00 nginx: master process ./nginx

www.dengb.comtruehttp://www.dengb.com/Linuxjc/1434189.htmlTechArticleLinux根据端口号查看进程PID linux根据端口号查看进程的pid。 1、命令 lsof,以查找占用端口80为例,用法如下: [root@localhost sbin]# lsof -i:80COM…

—-想了解更多的linux相关异常处理怎么解决关注<计算机技术网>

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请点击右边联系管理员删除。

如若转载,请注明出处:https://www.ctvol.com/linuxsystemusage/1001152.html

(0)
上一篇 2021年12月29日
下一篇 2021年12月29日

精彩推荐