I would like to view the internet usage for a single session, for example I connect to the WiFi at my local library which has a 200MB limit. Is it possible to connect and start tracking the data use - starting from zero and simply keep tracking until I reset or clear the history?

I have looked into

  • Ubuntu's pre-installed system monitor - this seems to track the total historical data for some given period
  • vnstat - same problem - by default -it aggregates historical data - e.g. how much data has already been used in sessions that have been and gone.

You can try a workaround using vnstat

man vnstat

-l, --live mode
              Display current transfer rate for the selected interface in real
              time until interrupted. Statistics will be shown after interrup‐
              tion if the runtime was more than 10 seconds. An  optional  mode
              parameter  can be used to select between the displaying of pack‐
              ets per second (mode 0) and transfer counters  (mode  1)  during
              execution.  --style can also be used to affect the layout of the

So you can use the live mode, this require manual starting and closing so start monitoring when start your session by running the command vnstat -l and close it by (ctrl+c) when you end your session.

$ vnstat -l

Monitoring eth0...    (press CTRL-C to stop)

   rx:        0 kbit/s     1 p/s          tx:        0 kbit/s     0 p/s^C

 eth0  /  traffic statistics

                           rx         |       tx
  bytes                      246 KiB  |         232 KiB
          max             624 kbit/s  |      620 kbit/s
      average           59.64 kbit/s  |    56.24 kbit/s
          min               0 kbit/s  |        0 kbit/s
  packets                        745  |             595
          max                121 p/s  |          86 p/s
      average                 22 p/s  |          18 p/s
          min                  1 p/s  |           0 p/s
  time                    33 seconds

If you want to see the result in live mode use the mode 1

$ vnstat -l 1

Monitoring eth0...    (press CTRL-C to stop)

   rx:      4 kbit/s   48 KiB             tx:     28 kbit/s   270 KiB

AS seen above received from starting the command is 48K running 4K/s while the transmitting is 270K running 28K/s

I think this is what do you want exactly

Another possible solution

Bitmeter OS

BitMeter OS is a free, open-source, bandwidth monitor that works on Windows, Linux and Mac OSX. BitMeter OS keeps track of how much you use your internet/network connection, and allows you to view this information either via a web browser, or by using the command line tools.

Download your version from here.

Now you can easily install it using

sudo dpkg -i bitmeter*.deb

Once it's installed locate your browser to http://localhost:2605/

enter image description here

Now to do the trick for your needs Go to Alert tab.

enter image description here

create a new Alert specifying the amount of data for Internet and time for your sessions. take a look for.

  • thanks, I have just been testing your vnstat solution. This is interesting, I had to use vnstat -l -i wlan0 to get it to work on a Wi-Fi interface. the ongoing "realtime" reporting is on the transfer rate. This means the only way you can check how much data is used is to ctrl + c cancel the process at which point the usage total get zeroed. So to get the total used in the session you would have to probably start a shell - name it "MB counter" and keep track of the totals from every time you checked vnstat. – the_velour_fog Jun 4 '15 at 10:39
  • You can view the consumption on real time, you don't need to kill the process – Maythux Jun 4 '15 at 10:42
  • Try it, you'll get your consumption on real time – Maythux Jun 4 '15 at 10:44
  • take a look : askubuntu.com/tour – Maythux Jun 4 '15 at 10:45
  • Thanks, your answer says An optional mode parameter can be used to select between the displaying of pack‐ ets per second (mode 0) and transfer counters (mode 1) during execution. does I need to enable this mode 1 to get the usage counter ? This answer is very close to a usable solution. If no other answers I would mark it as accepted, at the moment I just cant get the usage numbers to report – the_velour_fog Jun 4 '15 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.