首页 > 系统服务 > 详细

Linux查询端口由哪个程序或进程创建使用

时间:2021-08-26 11:36:44      阅读:16      评论:0      收藏:0      [点我收藏+]

环境

  • 系统:Debian10

过程

  • 查看端口号
    netstat -tnl
  • 这里测试8080端口
$ sudo lsof -i :8080
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
nginx   1139 root   13u  IPv4  44778      0t0  TCP localhost:45648->localhost:http-alt (ESTABLISHED)
java    4841 root   55u  IPv6  45438      0t0  TCP *:http-alt (LISTEN)

$ sudo lsof -i :139
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
smbd    2653 root   33u  IPv6  31000      0t0  TCP *:netbios-ssn (LISTEN)
smbd    2653 root   35u  IPv4  31002      0t0  TCP *:netbios-ssn (LISTEN)
  • 这里已经出来了,使用ps或者其他手段查看
$ ps -aux | grep 1139
$ ps -aux | grep nginx
root      1137  0.0  0.0   8392   900 ?        Ss   10:14   0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
root      1138  0.0  0.5  51604 45568 ?        S    10:14   0:00 nginx: worker process
root      1139  0.0  0.5  51604 45568 ?        S    10:14   0:00 nginx: worker process
root      1140  0.0  0.5  51604 45568 ?        S    10:14   0:00 nginx: worker process
root      1141  0.0  0.5  51604 45568 ?        S    10:14   0:00 nginx: worker process
uos       5098  0.0  0.0   9292   892 pts/0    S+   10:43   0:00 grep nginx

参考

manpage

lsof

Linux查询端口由哪个程序或进程创建使用

原文:https://www.cnblogs.com/wowcl/p/15188515.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!