James John – Software Engineer

Monitor Internet Data Usage in Ubuntu Using vnStat

Browsing without monitoring your internet data transfer is a bit messy, when I joined Linux earlier it was so hard for me to monitor my browsing rate. But lucky me I found a package that does that.

vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s). It uses the network interface statistics provided by the kernel as information source.

Firstly we have to install it if not installed, in Ubuntu:

sudo apt-get install vnstat 

Done with the installation, execute

vnstat

Which returns data analysis on all network interface as show below

vnstat

With the above you can view your network stat. This package also has a real time monitor for a selected network interface, assuming to monitor my WiFi Connection, I will run this

vnstat -l -i wlan0

What of viewing stat based on time, arguments for that also exists 🙂

Viewing in days:

vnstat -d -i wlan0

Hourly

vnstat -h -i wlan0

Monthly:

vnstat -m -i wlan0

Wish to pause monitoring of an interface?

sudo vnstat --disable -i wlan0

to enable use –enable parameter

These are the few I can write now 🙂

PS: -i parameter means interface which you can change it to the interface you wanna work with ( without -i parameter, default is eth0)

James John

Software Engineer