Get the information about the internet usage from the commandline.

vnstat
A wonderful command line utility to check the internet usage. It has got so many useful switch to display the data you want.Please visit the man page to get all the information.Get it from this website http://humdi.net/vnstat
Sample Output
Use it like this below:

vnstat -u -i interface forces a database update for interface or creates the database if it doesn't exist. This is
       usually the first command used after a fresh install.

       vnstat  -u  -i interface --nick nick gives interface the nickname nick and that information will be later included
       with queries.

       vnstat -u -r --disable -i interface resets the internal counters of interface and disables it from  being  updated
       before  enabled again with the --enable parameter. This feature is especially useful for interfaces like ppp0 that
       aren't always active.

And one of out put will be below,

sudo /usr/bin/vnstat -l
Monitoring ppp0...    (press CTRL-C to stop)

   rx:       0.00 kB/s     0 p/s            tx:       0.00 kB/s     0 p/s^C


 ppp0  /  traffic statistics

                             rx       |       tx
--------------------------------------+----------------------------------------
  bytes                         0 kB  |          0 kB
--------------------------------------+----------------------------------------
          max              0.05 kB/s  |     0.03 kB/s
      average              0.01 kB/s  |     0.00 kB/s
          min              0.00 kB/s  |     0.00 kB/s
--------------------------------------+----------------------------------------
  packets                          1  |             1
--------------------------------------+----------------------------------------
          max                  0 p/s  |         0 p/s
      average                  0 p/s  |         0 p/s
          min                  0 p/s  |         0 p/s
--------------------------------------+----------------------------------------
  time                    17 seconds

It has got so many wonderful switch to get the exact data you need.

0
2009-08-28 04:14:42

What Others Think

Thanks for sharing the code that helps in getting the information about internet usage from the commandline. image clipping service Everything is very well explained in which people get an idea about the code that helps in knowing about the content in detail
Kaitlyn · 21 weeks and 5 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: