Display data traffic statistics and estimates from vnStat for today and the current month on your Ubuntu Server login motd aka ‘message of the day.’
1. Install vnStat
sudo apt-get install vnstat
sudo vnstat -i eth0 -u --enable2. Add the script 60-vnstat to the motd
The number decides the position on the motd message. For example, 50 is the system info like system load and memory usage, and 90 is the update checker.
First write the script:
sudo nano /etc/update-motd.d/60-vnstat#!/bin/sh
vn="/usr/bin/vnstat -i eth0 -s"
echo
$vn | head -n 2 | tail -n 1 # header
$vn | tail -n 2 | head -n 1 # today
$vn | head -n 5 | tail -n 1 # monthThen make it executable:
sudo chmod 755 /etc/update-motd.d/60-vnstat3. Logoff and login again :)

Downloads
|
Rename to `60-vnstat` after download |