LinuxCommandLibrary

vnstat

Monitor network traffic usage

TLDR

Display traffic summary for all interfaces

$ vnstat
copy

Display traffic summary for a specific network interface
$ vnstat [[-i|--iface]] [network_interface]
copy

Display live stats for a specific network interface
$ vnstat [[-l|--live]] [[-i|--iface]] [network_interface]
copy

Show traffic statistics on an hourly basis for the last 24 hours using a bar graph
$ vnstat [[-hg|--hoursgraph]]
copy

Measure and show average traffic for 30 seconds
$ vnstat [[-tr|--traffic]] [30]
copy

SYNOPSIS

vnstat [options]

PARAMETERS

-q
    Quick query, shows current traffic rates.

-i
    Select interface for statistics.

-d
    Show daily statistics.

-h
    Show hourly statistics.

-m
    Show monthly statistics.

-t
    Show top traffic days.

-s
    Show summary statistics.

-v
    Show version information.

-u
    Update the traffic database.

-r
    Show realtime traffic rate.

-tr
    Show traffic rate for the given number of seconds.

-c
    Specify an alternate configuration file.

DESCRIPTION

vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for selected interfaces. It uses the network interface statistics provided by the kernel as information source. This means that vnStat won't actually be sniffing any traffic and also ensures light use of system resources. To keep things short: vnStat is small, easy to use, but has a lot of options to visualize the network traffic.

It's designed to provide a long-term record of network traffic activity, allowing users to analyze bandwidth usage patterns over time. Data is stored in a compact database, making it suitable for embedded systems and servers with limited resources. VnStat can display traffic statistics in various formats, including hourly, daily, monthly, and total summaries, and can be configured to track multiple interfaces. Because it logs data from the kernel directly, it consumes very little CPU. VnStat provides a way to monitor your network usage, plan your network usage and prevent unexpected bandwidth consumption.

CAVEATS

vnStat relies on kernel statistics. If the system is rebooted, the statistics since the last update will be lost. Also, it doesn't account for traffic that bypasses the monitored interface.

DATABASE LOCATION

The default location for the vnStat database files is /var/lib/vnstat/. Each interface has its own database file. The location can be changed in the configuration file.

CONFIGURATION FILE

The configuration file for vnStat is typically located at /etc/vnstat.conf. This file allows you to customize various aspects of vnStat, such as the interface to monitor, the database location, and the output format.

HISTORY

The first version of vnStat was released in 2001 by Teemu Toivola. It was created as a lightweight alternative to other network monitoring tools that were more resource-intensive. Over the years, vnStat has been actively developed and maintained, with numerous updates and improvements to its features and capabilities. It has become a popular choice for system administrators and users looking for a simple and efficient way to track network traffic on Linux and BSD systems. The popularity is based on its low footprint and the easy way to keep track of network traffic.

SEE ALSO

tcpdump(1), iftop(1), nload(1)

Copied to clipboard