【Linux学习笔记】netstat命令

跟風遠走 提交于 2019-12-01 17:31:49

luoluo牛再一次给我展示了他强大的linux能力,现总结下netstat的用法。


首先,看下netstat的man page:

NAME

 netstat - Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships

可以看到,netstat命令可以打印网络连接、路由表、接口统计、伪装链接和多播成员。


SYNOPSIS

       netstat    [--all|-a] [--numeric|-n] [--tcp|-t]  [--udp|-u] [--listening|-l]  [--program|-p][--statistics|-s]  [--help|-h]


参数解释:

netstat -a : 显示所有连接中和等待中的socket状态

netstat -n : 显示网络状态时,以数字表示地址(如localhost表示成127.0.0.1)

netstat -s : 按网络协议分类展示网络统计

netstat -t  : 显示TCP协议网络状态

netstat -u : 显示UDP协议网络状态

netstat -p : 显示进程名


常用组合:

1.netstat -an (Listing all the LISTENING Ports of TCP and UDP connections)

2.netstat -at (Listing only TCP (Transmission Control Protocol) port connections using netstat -at.)

3.netstat -l   (Listing all active listening ports connections with netstat -l.)

4.netstat -tp (Displaying service name with their PID number, using option netstat -tp will display “PID/Program Name”.)




参考:

http://www.tecmint.com/20-netstat-commands-for-linux-network-management/

http://write.blog.csdn.net/postedit/17555445

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!