[Linux]netstat

本文详细介绍了netstat命令的功能和用法,包括显示网络连接、路由表及网络接口统计等信息。netstat已不再维护,逐渐被ss和ip命令取代。文章还提供了多个示例帮助理解如何使用netstat。


功能:


打印网络连接、路由表、接口统计, 乔装(伪)连接和多路广播
## 描述:
netstat(network statistics的简写)是显示网络连接(传入和传出)、路由表、一些网络接口(网络接口控制器或软件定义的网络接口)的统计,

注明:
netstat已经不维护了,已经被ss和ip所代替

参数解析


{--route|-r}:查看内核路由表
-i:展示网路接口信息
-g: 展示IPv4 和 IPv6.组广播信息
-s:展示每种协议进行统计(传输层和网络层协议)
-a:显示所有选项,默认不显示LISTEN相关
-t:只展示tcp相关选项
-u:只展示udp相关选项
-n:不显示别名,能显示数字的全部转化成数字,最好先是别名,看着更清楚,不过查询端口的时候可能使用
-l:仅列出有在 Listen (监听) 的服务
-p:显示建立相关链接的程序名
-o:包括网络计时器
-l:只显示监听套接字
## 输出
Proto:socket使用的协议(tcp、udp、raw)
Recv-Q
Send-Q
Local Address
Foreign Address
State
见图(具体的值都是每个节点):

User
PID/Program name
Path


栗子


列出所有接口: netstat -a
显示本地系统网络活动的统计信息:netstat -an
列出tcp所有接口:netstat -at
只列出监听状态的端口:netstat -l
列出监听tcp的端口:netstat -lt
显示使用的所有端口的统计信息:netstat -s

其他相关命令


[**ac**](http://www.computerhope.com/unix/uac.htm) — Print statistics about the amount of time users have been connected.
[**arp**](http://www.computerhope.com/unix/arp.htm) — Manipulate the system ARP cache.
[**ifconfig**](http://www.computerhope.com/unix/uifconfi.htm) — View or modify the configuration of network interfaces.
[**ip**](http://www.computerhope.com/unix/ip.htm) — Display and manipulate information about routing, devices, policy routing and tunnels.
[**route**](http://www.computerhope.com/unix/route.htm) — Display and manipulate the IP routing table.
[**rpcinfo**](http://www.computerhope.com/unix/urpcinfo.htm) — Report information about Remote Procedure Calls.

参考资料


http://roclinux.cn/?p=2418
http://www.computerhope.com/unix/unetstat.htm

转载于:https://my.oschina.net/lowkeysoft/blog/889262

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值