Monitor your data usage in Linux
vnStat is a command line utility which helps users in monitoring, logging and viewing network statistics over various time periods for various network interfaces.
##How to install?
For Arch and its derivatives:
pacman -S vnstatFor Debian and its derivatives:
apt install vnstat##How to setup?
vnStat monitors data usage on a network interface basis so first you'll need to know the name of the network interface you want to monitor.
For that, run below command in terminal:
ip linkTo initialize monitoring on any network interface, run following command:
vnstat -u -i wlp0s20u2Here wlp0s20u2 is name of my network interface. Replace it with your network interface's name.
Now start vnStat daemon using below command, so that it can start monitoring network traffic.
systemctl enable --now vnstat##How to use?
Type "vnstat" in the terminal to get default data usage which is in the form monthly summary.
To see data usage of a particular network interface:
vnstat -i wlp0s20u2To see daily data usage of a particular network interface:
vnstat -i wlp0s20u2 -dTo see hourly data usage of the past 24 hours of a particular network interface:
vnstat -i wlp0s20u2 -hYou can monitor weekly, monthly, yearly and live(at this moment) data usage by using various flags which I leave up to you to find out.