查看linux端口占用情况

1. lsof -i:80 查看80端口占用情况

[root@aliyun ~]# lsof -i:80
COMMAND     PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
AliYunDun  7227 root   18u  IPv4    13595      0t0  TCP iZuf693xexk1tty4tct4hfZ:59644->106.11.68.13:http (CLOSE_WAIT)
AliYunDun  7227 root   21u  IPv4  3742635      0t0  TCP iZuf693xexk1tty4tct4hfZ:38242->106.11.68.13:http (CLOSE_WAIT)
AliYunDun  7282 root   18u  IPv4    13595      0t0  TCP iZuf693xexk1tty4tct4hfZ:59644->106.11.68.13:http (CLOSE_WAIT)
AliYunDun  7282 root   21u  IPv4  3742635      0t0  TCP iZuf693xexk1tty4tct4hfZ:38242->106.11.68.13:http (CLOSE_WAIT)
AliYunDun  7282 root   23u  IPv4 32249264      0t0  TCP iZuf693xexk1tty4tct4hfZ:33204->140.205.140.205:http (ESTABLISHED)
docker-pr 25816 root    4u  IPv6 33460920      0t0  TCP *:http (LISTEN)
[root@aliyun ~]# lsof -i
COMMAND     PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
dhclient    760 root    6u  IPv4    12305      0t0  UDP *:bootpc
dhclient    760 root   20u  IPv4    12270      0t0  UDP *:31889
dhclient    760 root   21u  IPv6    12271      0t0  UDP *:58819
ntpd        858  ntp   16u  IPv4    13047      0t0  UDP *:ntp
ntpd        858  ntp   17u  IPv6    13048      0t0  UDP *:ntp

3. netstat -apn|grep 80 查看80端口占用情况

[root@aliyun ~]#  netstat -apn|grep 80
tcp        0      0 172.19.200.200:33204    140.205.140.205:80      ESTABLISHED 7282/AliYunDun
tcp      391      0 172.19.200.200:59644    106.11.68.13:80         CLOSE_WAIT  7227/AliYunDunUpdat
tcp      401      0 172.19.200.200:38242    106.11.68.13:80         CLOSE_WAIT  7227/AliYunDunUpdat
tcp6       0      0 :::80                   :::*                    LISTEN      25816/docker-proxy
unix  2      [ ]         DGRAM                    9680     1/systemd            /run/systemd/shutdownd
unix  2      [ ]         DGRAM                    11983    480/crond
unix  3      [ ]         STREAM     CONNECTED     11817    480/crond
    原文作者:Joncc
    原文地址: https://www.jianshu.com/p/1b32dd246c7b
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞