在 Debian 里,ifconfig 本身只能看累计流量,不能看实时速率。下面分情况说明。
ifconfig eth0
(把 eth0 换成你的网卡名,用 ip addr 或 ifconfig -a 查看)
示例输出:
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.10 netmask 255.255.255.0
RX packets 123456 bytes 987654321 (987.6 MB)
TX packets 654321 bytes 123456789 (123.4 MB)
含义:
⚠️ 注意:
ip -s link(系统自带)ip -s link show eth0
watch + ifconfig(简单估算速率)watch -n 1 "ifconfig eth0 | grep bytes"
每 1 秒刷新一次,靠差值估算速率。
iftop(实时流量监控)sudo apt install iftop
sudo iftop -i eth0
nload(整体网卡速率)sudo apt install nload
nload eth0
vnstat(流量统计)sudo apt install vnstat
vnstat -l -i eth0 # 实时
vnstat # 日/月统计
| 需求 | 命令 |
|---|---|
| 看累计流量 | ifconfig eth0 |
| 看实时速率 | iftop / nload |
| 长期统计 | vnstat |
如果你是想:
可以告诉我场景,我给你更精确的命令。