vnstat: Network Bandwidth Usage Monitor for Ubuntu Linux (CLI)

If your internet connection has a monthly bandwidth threshold or you just need a tool to monitor your daily/monthly/yearly network traffic usage, then a network bandwidth monitoring utility is a must have.

If you’re searching for a utility with a GUI then NTM is a pretty elegant solution. But if you wouldn’t mind it if doesn’t have a GUI and want it to be lightweight, then “vnstat” too is a pretty handy utility.

Just like many other bandwidth monitors, “vnstat” also fetch the data via the “proc” file system and because of that you can use “vnstat” for getting network usage statistics without having to be a system administrator.

Main features …

*. Shows bandwidth usage for Hourly, Daily, Weeks and Monthly.

*. It also has the ability to ‘forecast’ your network traffic usage by based on the current data.

*. Shows live network transfer rates (uploading and downloading), network data usage of multiple network device.

*. A daily summary.

*. Lets you reset and delete the saved data.

*. Ability to show the output in a XML friendly format.

*. View top 10 entries in your bandwidth usage history … are some of its features to mention.

You can install “vnstat” in Ubuntu 12.10, 12.04 Precise Pangolin, 11.10 Oneiric Ocelot, 11.04 Natty Narwhal, 10.10 and 10.04 by typing the below command in your Terminal window.

sudo apt-get install vnstat

It maybe a command-line based utility but it has a lot of features as well. It has a system service daemon that runs on the background and monitors the network automatically.

For those who use Wi-Fi

By default “vnstat” uses your Ethernet network interface (eth0). So if you wanted to get the live traffic rate of your Wi-Fi interface, then you’d have to manually enter Wi-Fi interface name.

It’s pretty easy actually. For that I’d use the below command.

vnstat -l -i wlan0

The “l” (simple “L) argument represents the live output and “i” for defining the network interface. Depending on your network device, please replace ‘wlan0’ accordingly.

If I wanted get the total sum of bandwidth usage for all the network interfaces then I’ll simply use the below command.

vnstat

But again, if I wanted the network usage of “Wi-Fi” device only, then I’ll use the below command.

vnstat -i wlan0

You can learn more about its command-line parameters by reading its manual by using the below command.

man vnstat

Hourly rates with Graphs (sort of) …

Anyway, for the average users, if you already have some sort of a GUI utility and quite happy with it, then this might not a replacement. But if you’re someone like a system administrator who’s been searching for a resources friendly, command-line based, network bandwidth usage meter, then “vnstat” is certainly an excellent little utility that’s worthy of your attention ;-).

Leave a Comment

%d bloggers like this: