简介:
netstat:这个命令,相信会平时大家也会经常用到,主要用于显示网络相关信息:如网络连接,路由表,端口统计,伪连接,多播成员等
使用:
netstat [address_family_options] [--tcp|-t] [--udp|-u] [--raw|-w] [--listening|-l] [--all|-a] [--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users] [--symbolic|-N] [--extend|-e[--extend|-e]] [--timers|-o] [--program|-p] [--verbose|-v] [--continuous|-c] netstat {--route|-r} [address_family_options] [--extend|-e[--extend|-e]] [--verbose|-v] [--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users] [--continuous|-c] netstat {--interfaces|-i} [--all|-a] [--extend|-e[--extend|-e]] [--verbose|-v] [--program|-p] [--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users] [--continuous|-c] netstat {--groups|-g} [--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users] [--continuous|-c] netstat {--masquerade|-M} [--extend|-e] [--numeric|-n] [--numeric-hosts] [--numeric-ports] [--numeric-users] [--continuous|-c] netstat {--statistics|-s} [--tcp|-t] [--udp|-u] [--raw|-w] netstat {--version|-V} netstat {--help|-h}
参数:(netstat打印Linux网络子系统的信息,由第一个参数决定打印出来什么信息类型)
(none) #By default, netstat displays a list of open sockets.If you don't specify any address families, then the active sockets of all configured address families will be printed. --route,-r #显示路由表信息(netstat -r and route -e produce the same output.) --groups,-g #为IPv4和IPv6组播组成员信息 --interfaces,-i #显示所有网络接口 --masquerade,-M #显示伪连接信息 --statistics,-s #每个连接的摘要统计
选项:
-t #显示tcp相关选项 -u #显示udp相关选项 --verbose,-v #详细显示用户正在进行的工作。尤其是一些未配置的address families的有用的信息 --numeric,-n #使用数值表示的主机地址,端口和用户名 --numeric-hosts #使用数值表示的地址,但不影响端口和用户名 --numeric-ports #使用数值表示的端口,但不影响主机地址和用户名 --numeric-users #使用数值表示的端口,但不影响地址和用户名 -c, --continuous #连续显示查询出的信息 -e, --extend #显示附加信息 -o, --timers #Include information related to networking timers. -p, --program #显示程序的PID和name -l, --listening #显示正在监听的程序 -a, --all #显示所有监听的和不监听的程序 -F #从路由表显示路由信息 -C #从路由缓存中显示路由信息
还有部分参数没有介绍到,以及输出的具体详情,请看手册页,此处不再详述。
常用示例:(不再详述)
$ sudo netstat -tunlp $ sudo netstat -s
转载于:https://blog.51cto.com/xuclv/1166393