Is it possible to get daily internet data usage report in Linux?

Is there any application in ubuntu 20.04 to have report of daily internet data usage

if possible then for month also?

OR is there any command to use in terminal?

ISPs have this information, so it MUST be possible.
However I myself never wanted to have this, I just don’t care. So at the moment I don’t have any clue how to do it?
If there would be an absolute must to know it, I would investigate how to do it with sar from sysstat.

sooo kind of u sir :heart: :heart:

Hello, :wave:

I was asking myself this very question a long time ago. :blush:

As my internet connection is established by means of a 4g-stick (mobile internet) only I have to make sure to stay well within the data limits (or rather data allowance which is given to me).

My data plan is thus: 5 GB per 28 days (about 178 MB per day).
That´s pretty sufficient to me (1 physical PC and 2 VMs).

So I wrote a script which (when executed) provides a pop-up window which looks like this:

Output is the following:

  • today´s data usage (up to now)
  • total usage (from beginning of a certain period)
  • amount of data which can still be used
  • amount of data which I´ve saved up to now
  • data usage as average/day
  • n.th day since beginning of period
  • how many days till end of period

My code certainly has some shortcomings but works well for my purposes. :blush:

I don´t know if that´s in any way something you´re looking for. :thinking:

… in which case I´d be glad to provide the script. But it would have to be re-written for your personal settings I´m afraid. So a bit of manual work involved here. :neutral_face:

Many greetings.
Rosika :slightly_smiling_face:

2 Likes

Hi Can Someone please help me to retain my Instagram account back?? Any professional service provider here?

Sure and it’s only 420 bucks an hour. :wink:

this seems nice to me
you can provide the codes for terminal

and is there any privacy issue with this command as it will keep an eye on my internet usage… so is this safe…or there can be data leak something like that…or password hack or anything :sweat_smile:

@kamranhere:

Hi again, :wave:

Here´s the link to the bash-script I`ve written:

bash script for monitoring data usage · GitHub .

The comments are in German but I annotated some preliminaries at the start of the script in English.

The interface to be monitored has to be adjusted in the script of course.

Some shortcomings:

  • script is usable from the second day of the period onwards. That´s due to how vnstat changes its output after the first day.
    The script can be re-written to cater for this one-day-pupose but in my opinion it wasn´t worth the effort.

  • the script surely works fine as long as my data consumption is under 1 GB (or 1000 MB) per day. That´s good enough for me. If anything else is needed… feel free to re-write it :wink:

Surely there´s an easier way of writing a script for the purpose of data usage monitoring.
But for me it works and any mofifications are welcome. :smiley:

No, I´don´t think there are are privacy issues involved.

The script mainly relies on vnstat and as long as that´s safe to use I don´t think you need to worry.

Many greetings from Rosika :slightly_smiling_face:

P.S.:

I´m sure you know this, but just in case:

name the script whatever you like (e.g. data-consumption.sh ) and then make it executable

chmod +x data-consumption.sh

2 Likes

my goodness :roll_eyes:
what the heck was that :grimacing:

this much heavy coding i have to do !!! :hot_face:

for just getting my usage report…lol :stuck_out_tongue:

i am going to jump out through window after watching this :joy: Rosi
BTW you have really done a lot of work while creating these codes…salute to you for that

But for a new noobie like me this was just grossssssss :sweat_smile:

1 Like

Hi @kamranhere: :wave:

Sorry I couldn´t reply rearlier. :slightly_frowning_face:

Actually you don´t have to do the coding yourself.
If you are satisfied with the script the way it is just copy the code (you can also use the RAW-view from here:
https://gist.githubusercontent.com/Rosika2/5f74978a2d6fbd4eb35c4a4b859aa98f/raw/3407476a37e92149b2a694ed69c58787795bee36/bash%20script%20for%20monitoring%20data%20usage ).

Put it in a text-file but use .sh at the end of the file-name (e.g. data-consumption.sh ) and then make it executable: chmod +x data-consumption.sh .

But - as I´ve already said - you have to provide the correct interface to be monitored. The name of the one you´re using is certainly different from mine (enx001e101f0000).

Well, to be honest, I wanted to have a bit more info than just my daily or monthly data usage. :blush:

As mentioned above:

If you´re interested in just daily/monthly usage report you need to look no further than vnstat (vnStat - a network traffic monitor for Linux and BSD ) itself (from the terminal):

Many greetings from Rosika :slightly_smiling_face:

P.S.:

Please don´t do that. :pensive:

Thanks a lot. But I´m sure there would have been an easier way for reaching my goal(s) :wink:

1 Like

Hi, :wave:

some additional info regarding vnstat can be found here:

Perhaps the installation of vnstati might satisfy @kamranhere ´s needs (“image output”).

Two example pictures taken from the site mentioned above look like this:

image

and

Many greetings from Rosika. :slightly_smiling_face:

2 Likes