在 Linux 中,ifconfig 本身可以查看网络接口的流量统计信息,虽然它不能像专业工具那样实时显示速率,但可以看到累计收发字节数和包数。
ifconfig
或指定网卡(如 eth0):
ifconfig eth0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.10 netmask 255.255.255.0
RX packets 123456 bytes 98765432 (94.1 MiB)
TX packets 654321 bytes 123456789 (117.7 MiB)
⚠️ 注意:
这是系统启动以来的累计值,不是实时速率。
ifconfig eth0 | grep "RX bytes"
等待 10 秒
再次查看:
ifconfig eth0 | grep "RX bytes"
ip 命令(ifconfig 的替代)ip -s link
或指定网卡:
ip -s link show eth0
iftop(按连接看流量)iftop -i eth0
nload(简单的网卡速率图)nload eth0
sar(系统级统计)sar -n DEV 1
| 方式 | 是否实时 | 说明 |
|---|---|---|
| ifconfig | ❌ | 看累计流量 |
| ip -s | ❌ | 更现代 |
| iftop | ✅ | 实时、按连接 |
| nload | ✅ | 实时、直观 |
| sar | ✅ | 历史/实时 |
如果你告诉我:
我可以给你更精确的命令。