Vnstat - Network Traffic Monitor & Log

Monitor network traffic with Vnstat. View daily, monthly, and hourly usage, export data in JSON, and manage network interface statistics.

Vnstat

Vnstat: Command-Line Network Traffic Monitor

Vnstat is a powerful command-line utility for monitoring network traffic. It keeps a log of daily, weekly, monthly, and yearly network traffic, providing detailed insights into your bandwidth usage. This tool is invaluable for system administrators and users who need to track and manage their network activity effectively.

Key Vnstat Commands and Usage

Below are common commands to utilize Vnstat for monitoring network traffic. These examples demonstrate how to view summaries, specific timeframes, and manage interface data.

Viewing Network Traffic Summaries

Use these commands to get quick overviews of your network data.

# Display a summary of the current month's network traffic
vnstat -m

# Display a summary of the traffic for the current day
vnstat -d

# Show the hourly traffic usage for a specific day
vnstat -h

# Display real-time traffic statistics
vnstat -l

# Display a live, continually updating traffic report
vnstat -tr

Data Export and Interface Management

Learn how to export your traffic data and manage specific network interfaces.

# Export all data in JSON format
vnstat --json

# Display traffic statistics for a specific network interface (e.g., eth0)
vnstat -i eth0

# Reset all data for a specific interface (caution: this deletes all recorded data)
vnstat --reset -i eth0

# Display traffic statistics in kilobytes
vnstat --unit k

# Display detailed help for vnStat options
vnstat --help

Understanding Network Monitoring with Vnstat

Vnstat provides a flexible way to monitor network bandwidth. Whether you need to check daily consumption, analyze monthly trends, or export data for further processing, Vnstat offers the necessary commands. Its ability to display real-time statistics and manage specific interfaces makes it a versatile tool for network analysis.

Further Resources