LinuxCommandLibrary

vnstat

Console-based network traffic monitor

TLDR

Display traffic summary for all interfaces

$ vnstat
copy
Display traffic summary for a specific interface
$ vnstat -i [network_interface]
copy
Display live stats for a specific interface
$ vnstat -l -i [network_interface]
copy
Show hourly traffic statistics with bar graph
$ vnstat -hg
copy
Measure and show average traffic for 30 seconds
$ vnstat -tr 30
copy

SYNOPSIS

vnstat [options] [interface]

DESCRIPTION

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.

PARAMETERS

-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

CAVEATS

Requires vnstatd daemon to be running for data collection. Initial statistics require time to accumulate. Traffic counters may reset if the interface is reconfigured. Statistics are based on kernel counters, not packet inspection.

SEE ALSO

vnstatd(8), iftop(8), nethogs(8), nload(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community