How to Monitor your web server bandwidth usage with vnstat
To use nethogs on a Ubuntu/Debian server or desktop it is easy. First start by installing it using the command:
apt-get install -y nethogs
The you can use it this way:
# Start nethogs on the default network interface
# Specify which network interface and to refresh every 1 second
nethogs -d1 eth0
If you want to try vnstat you have to start the compilation of the data and then you can use it or you can check the Live traffic.
apt-get install -y vnstat
Now to use it execute the command line:
#Show live trafic
# Start monitoring the trafic
vnstat -u -i eth0
# Check your daily traffic (but you need to start the monitoring and gather the data before you can use it)
Start the service to collect the data.
service vnstat start