linux:查看网卡的发送接收数据量统计

一,使用ip命令:

命令:  ip -s link

-s[tatistics]   : 统计

[root@web mysql]# ip -s link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    RX:  bytes packets errors dropped  missed   mcast
    5119067602 4317489      0       0       0       0
    TX:  bytes packets errors dropped carrier collsns
    5119067602 4317489      0       0       0       0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
    link/ether ...
    RX:  bytes  packets errors dropped  missed   mcast
    7914191224 12011379      0       0       0       0
    TX:  bytes  packets errors dropped carrier collsns
    4243490577  8626349      0       0       0       0
    altname enp0s6
    altname ens6

 说明:

  • TX:发送流量
  • RX:接收流量

二,使用ifconfig命令:

[root@web mysql]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet ...
        inet6 ...
        ether ...
        RX packets 12013047  bytes 7914402135 (7.3 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 8627500  bytes 4244454580 (3.9 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 4318063  bytes 5119407050 (4.7 GiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4318063  bytes 5119407050 (4.7 GiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 说明:ifconfig命令已经不被某些发行版内置安装,例如ubuntu 21.10,建议大家优先使用ip命令:

liuhongdi@lhdpc:/api$ ifconfig
Command 'ifconfig' not found, but can be installed with:
sudo apt install net-tools

 

三,查看实时的流量:

nload: 统计网卡上的流入和流出数量
          可以统计到网卡

iftop:  统计各客户端到服务器的流量,
          可以统计到ip

nethogs: 统计到各进程的流量

 

posted @   刘宏缔的架构森林  阅读(222)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 一文读懂知识蒸馏
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
历史上的今天:
2021-09-28 vue.js 3.0.5:用vue-i18n开发i18n国际化功能(vue-i18n@9.2.0)
点击右上角即可分享
微信分享提示