Ubuntu

How to install and use vnStat on Ubuntu 22.04

The vnStat is a lightweight, open-source command-line utility used to monitor network traffic on Linux operating systems. A network administrator generally uses it to monitor the bandwidth consumption with a minute-by-minute, hourly, daily, weekly, monthly and yearly update.

This tutorial guides you in installing vnStat on Ubuntu 22.04 to monitor network traffic on your system.

Installing vnStat on Ubuntu 22.04

The default Ubuntu repository includes the latest version of vnStat, which is 2.9; thus, it makes the installation pretty straightforward on Ubuntu.

The vnStat installation can easily be completed by executing a single command in the terminal, which is shown below:

$ sudo apt install vnstat

After the vnStat installation is completed, you can then check its version with the help of the below-mentioned command:

$ vnstat --version

The above command ensures that the latest version of vnStat is successfully installed on the system.

To enable vnStat, use the following command:

$ sudo systemctl enable vnstat

After enabling the vnStat, execute the following command to verify whether the service is running fine.

$ sudo systemctl start vnstat

The above output ensures that the vnStat is active and is running perfectly fine. If the vnStat service stops, execute the following command to start it.

$ sudo systemctl start vnstat

Monitor Network Traffic using vnStat

The vnStat offers several options to help you monitor network traffic in several ways. So whether you are looking for a network update at any time, you will get the desired information right onto your terminal through following command:

$ vnstat --help

In case, if you want to monitor the network traffic for five minutes, use the following command.

$ vnstat -5

For daily network traffic monitoring, use the following command:

$ vnstat -d

If you need additional help, you can use the following command to get the list of different commands you can use with vnStat.

$ vnstat --longhelp

Removing vnStat from Ubuntu 22.04

If you no longer want to use vnStat services on your system, you can execute the following command to remove the application from your system.

$ sudo apt remove --autoremove vnstat

Conclusion

The vnStat is a lightweight utility used to monitor network traffic on Linux operating systems. It provides you the system’s bandwidth consumption of any time right onto your command-line terminal. The above installation guide will help you install the latest version of vnStat through the official Ubuntu repository so that you will be able to monitor network traffic on your system.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.