Linux指令 —— netstat

netstat

man - Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
打印网络连接、路由表、接口状态、无效连接、多播成员这些信息。

列出所有端口(包括监听和未监听的)

netstat -a

拓展

[root@localhost ~]# netstat -at    #TCP端口
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 localhost:6379          0.0.0.0:*               LISTEN     
tcp        0      0 localhost.locald:domain 0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:ssh             0.0.0.0:*               LISTEN     
tcp        0      0 localhost:ipp           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:postgres        0.0.0.0:*               LISTEN     
tcp        0      0 localhost:smtp          0.0.0.0:*               LISTEN     
tcp6       0      0 [::]:ssh                [::]:*                  LISTEN     
tcp6       0      0 localhost:ipp           [::]:*                  LISTEN     
tcp6       0      0 [::]:postgres           [::]:*                  LISTEN     
tcp6       0      0 localhost:smtp          [::]:*                  LISTEN     
[root@localhost ~]# netstat -au    #UDP端口
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
udp        0      0 0.0.0.0:47080           0.0.0.0:*                          
udp        0      0 localhost.locald:domain 0.0.0.0:*                          
udp        0      0 0.0.0.0:bootps          0.0.0.0:*                          
udp        0      0 0.0.0.0:mdns            0.0.0.0:*                          
udp6       0      0 localhost:55899         localhost:55899         ESTABLISHED
[root@localhost ~]# 

显示进程ID号

netstat -p

处于监听状态的socket口

netstat -l        #只显示监听端口

显示所有端口的统计信息

netstat -s   显示所有端口的统计信息

重点是灵活组合,具体很多显示的信息,不太明白!


Linux命令大全——netstat
Linux: 10 个 Netstat 命令实例

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值