安装:
sudo apt-get install vnstat
查看帮助:
vnstat --version
dr@dr-OptiPlex-3010:~$ vnstat --help vnStat 1.11 by Teemu Toivola <tst at iki dot fi> -q, --query query database -h, --hours show hours -d, --days show days -m, --months show months -w, --weeks show weeks -t, --top10 show top10 -s, --short use short output -u, --update update database -i, --iface select interface (default: eth0) -?, --help short help -v, --version show version -tr, --traffic calculate traffic -ru, --rateunit swap configured rate unit -l, --live show transfer rate in real time See also "--longhelp" for complete options list and "man vnstat".
上面只是简单使用列表,要查看详细使用可以man vnstat,或者用vnstat --longhelp
例如,查看一个月内的网络流量情况:
dr@dr-OptiPlex-3010:~$ vnstat -m eth0 / monthly month rx | tx | total | avg. rate ------------------------+-------------+-------------+--------------- Feb '13 2.99 MiB | 618 KiB | 3.59 MiB | 0.02 kbit/s ------------------------+-------------+-------------+--------------- estimated -- | -- | -- | dr@dr-OptiPlex-3010:~$