Linux使用sar命令查看网络IO、网卡流量、实时网速

命令:
sar –n DEV 1 4
解释:

sar - Collect, report, or save system activity information.

sar,收集、报告或保存系统活动信息

-n,Report network statistics.

Possible keywords are DEV, EDEV, NFS, NFSD, SOCK, IP, EIP, ICMP, EICMP, TCP,
ETCP, UDP, SOCK6, IP6, EIP6, ICMP6, EICMP6 and UDP6.

With the DEV keyword, statistics from the network devices are reported.

-n DEV,报告网络设备统计信息,参数还可以是EDEV, NFS, NFSD, SOCK, IP, EIP, ICMP, EICMP, TCP, ETCP, UDP, SOCK6, IP6, EIP6, ICMP6, EICMP6 and UDP6

1 4,每一秒钟取一次值,取四次

执行结果:
11:45:36 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
11:45:37 AM      eth0      0.99      0.99      0.05      0.10      0.00      0.00      0.00
11:45:37 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00

11:45:37 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
11:45:38 AM      eth0      1.01      1.01      0.05      0.20      0.00      0.00      0.00
11:45:38 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00

11:45:38 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
11:45:39 AM      eth0      1.01      1.01      0.05      0.39      0.00      0.00      0.00
11:45:39 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00

11:45:39 AM     IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
11:45:40 AM      eth0      1.01      1.01      0.05      0.39      0.00      0.00      0.00
11:45:40 AM        lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00

Average:        IFACE   rxpck/s   txpck/s    rxkB/s    txkB/s   rxcmp/s   txcmp/s  rxmcst/s
Average:         eth0      1.01      1.01      0.05      0.27      0.00      0.00      0.00
Average:           lo      0.00      0.00      0.00      0.00      0.00      0.00      0.00
输出信息说明:
  • IFACE:LAN接口
  • rxpck/s:每秒钟接收的数据包
  • txpck/s:每秒钟发送的数据包
  • rxbyt/s:每秒钟接收的字节数
  • txbyt/s:每秒钟发送的字节数
  • rxcmp/s:每秒钟接收的压缩数据包
  • txcmp/s:每秒钟发送的压缩数据包
  • rxmcst/s:每秒钟接收的多播数据包

你可能感兴趣的:(linux)