Skip to content
-
Subscribe to our newsletter & never miss our best posts. Subscribe Now!
The Server Admin
The Server Admin
  • Home
  • Linux
  • Windows
  • About
  • What Powers The Server Admin
  • Home
  • Linux
  • Windows
  • About
  • What Powers The Server Admin
Close

Search

  • https://www.facebook.com/
  • https://twitter.com/
  • https://t.me/
  • https://www.instagram.com/
  • https://youtube.com/
Subscribe
Linux

Vnstat

By Anthony
May 14, 2025 4 Min Read
0

Source: https://www.geeksforgeeks.org/vnstat-command-in-linux-with-examples/

vnstat is a command-line tool in Linux that is generally used by system administrators in order to monitor network parameters such as bandwidth consumption or maybe some traffic flowing in or out. It monitors the traffic on the system’s network interfaces. 

Installing vnstat on Linux

In case of RedHat-based Linux  

yum install vnstat

In case of a ubuntu or Debian Linux 

apt install vnstat 

Working with vnstat Command

1. To get basic stats of all network interfaces 

To see an overview of the network traffic on all connected interfaces:

vnstat

This command will print all the basic stats of the network interfaces connected to the system. 

2. To monitor a specific interface

If you want to focus on a specific network interface, use the -i option to specify the interface name:

vnstat -i wlo1

This will monitor and display the stats of the specified interface that is wlo1. 

3. To get the daily stats of an interface 

To view daily traffic stats on a particular interface:

vnstat -d -i wlo1

This will print the daily stats of the specified interface which is wlo1. 

4. To get the hourly stats of an interface 

For more granular data, you can check hourly stats with:

vnstat -h -i wlo1

This will print the hourly stats of the specified interface which is wlo1. 

5. To display the monthly stats of a interface 

To get a broader view of network usage, use the following command to see monthly statistics:

vnstat -m -i wlo1

This command will display the monthly stats of the specified interface. 

6. To save output to a XML file 

If you need to export your network traffic data in XML format for further analysis or automation, use this command:

vnstat --xml -i wlo1 >output.xml

The command will create an XML file with name output.xml and will have the output of the command in XML format. 

7. To save output to a JSON file 

For those working with data pipelines or web applications, you may want the data in JSON format. Use the following command:

vnstat --json -i wlo1 >output.json

This command will create a JSON file with name output.json and will have the output of the command in JSON format. 

8. To save output to a text file 

To save the output in a simple text file format, you can use:

vnstat --oneline -i wlo1 >output.txt

This command will create a text file with name output.txt and will have the output in a one-line format. 

9. To calculate traffic on the current interface 

If you want to see real-time network traffic statistics, you can use the -tr option:

vnstat -tr

This command will display the traffic on the current network interface in use. 

10. To display vnstat help 

To learn more about vnstat and its available options, run the help command:

vnstat --help

This command will display the vnstat help section.

Conclusion

The vnstat command is a powerful and flexible tool for monitoring network traffic on Linux systems. Whether you are a system administrator looking to track bandwidth usage or simply someone interested in analyzing network performance, vnstat provides a range of features that cater to both basic and advanced needs.

Author

Anthony

Follow Me
Other Articles
Previous

Install Samba in Debian

Next

Install OpenSSH on your Desktop

Search

Need a Virtual Server for sysctl testing? Check out our plans!

Popular Posts

  • Mount sFTP folder as local drive
    by Anthony
    June 9, 2026
  • Robocopy Examples
    by Anthony
    February 12, 2026
  • Rsync Command Examples
    by Anthony
    February 10, 2026

Trending

  • Mount sFTP folder as local drive
    by Anthony
    June 9, 2026
  • Adding a GUI to a Server or VPS
    by Anthony
    August 27, 2024
  • Back up to a shared folder with Time Machine on Mac
    by Anthony
    January 4, 2025
  • Backup Your Databases
    by Anthony
    March 24, 2024

Editors Picks

    Send an email:
    mail@example.com

    Call me:
    123-456-7890

    • Facebook
    • Twitter
    • Instagram
    • TikTok
    • LinkedIn
    • Behance
    Copyright 2026 — The Server Admin. All rights reserved. Blogsy WordPress Theme