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

时间:2021-08-26 11:36:44   收藏:0   阅读:17

环境

过程

$ 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 -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

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

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!