← 返回命令列表

Linux command

vnstat 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Display

vnstat

Display

vnstat -i [network_interface]

Display

vnstat -l -i [network_interface]

Show

vnstat -hg

Measure

vnstat -tr 30

说明

vnstat is a console-based network traffic monitor that keeps a log of network traffic for selected interfaces. It uses kernel interface statistics for minimal resource usage. The daemon (vnstatd) runs in the background collecting data, while the vnstat command queries and displays the collected statistics. Data persists across reboots in a database.

参数

-i, --iface _interface_
Select specific interface
-l, --live
Display live traffic statistics
-hg, --hoursgraph
Show hourly statistics as bar graph
-tr, --traffic _seconds_
Measure traffic for specified duration
-d, --days
Show daily statistics
-m, --months
Show monthly statistics
-t, --top
Show top traffic days
-s, --short
Use short output format
--json
Output in JSON format
--xml
Output in XML format

FAQ

What is the vnstat command used for?

vnstat is a console-based network traffic monitor that keeps a log of network traffic for selected interfaces. It uses kernel interface statistics for minimal resource usage. The daemon (vnstatd) runs in the background collecting data, while the vnstat command queries and displays the collected statistics. Data persists across reboots in a database.

How do I run a basic vnstat example?

Run `vnstat` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -i, --iface _interface_ do in vnstat?

Select specific interface