Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 08-09-2005, 05:56 PM   #1
Registered: Oct 2003
Location: Bozeman, Montana
Distribution: Gentoo 2010, Ubuntu 9.04
Posts: 175

Rep: Reputation: 30
Monitoring Bandwidth

I will be heading off to live in the dorms in about 2 weeks and was informed that they monitor the bandwidth pretty heavily. 2GB d/l per day is what they say they allow roughly. Is there a way to monitor how much data I have transfered in a day? I would like to stay as close to my 2GB limit as possible because I'm paying for the connection so might as well use it. Thanks

Old 08-09-2005, 06:20 PM   #2
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
ifconfig itself shows sent(TX) and recieved(RX) bytes since the connection was acquired, so if you dont keep your machine on 24/7, or reset your connection every 24 hours, this would make a simle way of monitoring it:
ifconfig | grep RX | grep bytes | cut -d "(" -f 2 | cut -d ")" -f 1
That snippet will get you the info you want neatly.. Ofcourse there is prolly some nifty program for better monitoring, but hey, thats what search engines are for, right? (;

Put up quicly a nicer output and interface to that quick grepping.. Its set up so that if you give any parameter at all, also the second interface is shown, if no parameter is given, only the first is shown. Just to show you an idea:
echo -n "|eth0|"
echo -n " down: "
echo -n $(ifconfig | grep bytes | cut -d "(" -f 2 | cut -d ")" -f 1 | head -n 1)

echo -n "  |  up: "
ifconfig | grep bytes | cut -d "(" -f 3 | cut -d ")" -f 1 | head -n 1

if [ ! -z $1 ]; then
echo -n "|eth1|"
echo -n " down: "
echo -n $(ifconfig | grep bytes | cut -d "(" -f 2 | cut -d ")" -f 1 | head -n 2 | tail -n 1)

echo -n "  |  up: "
ifconfig | grep bytes | cut -d "(" -f 3 | cut -d ")" -f 1 | head -n 2 | tail -n 1


Last edited by Artanicus; 08-09-2005 at 06:35 PM.
Old 08-09-2005, 06:45 PM   #3
Bruce Hill
HCL Maintainer
Registered: Jun 2003
Location: McCalla, AL
Distribution: Funtoo
Posts: 6,926

Rep: Reputation: 128Reputation: 128
Not as nice as a script, and I'm not even sure of the accuracy,
but with GkrellM you can hover your mouse over the eth0
(or appropriate) NIC display window, and a small rectangle will
appear in the bottom right of that area. Then just click on the
rectangle and you will get a window pop up with statistics for
Daily, Weekly, and Monthly received, transmitted, and total.
Old 10-15-2005, 01:59 PM   #4
LQ Newbie
Registered: Sep 2005
Location: Colorado
Distribution: Mandriva LE 2005
Posts: 12

Rep: Reputation: 0
This info is available in /proc/net/dev but it is pretty hard to read as is. Running it through something like the following can clean it up. But it still needs some work.

awk '/eth0/ {print "Rx total:",$2,"b\nTx total:",$10,"b"}' /proc/net/dev
Old 10-15-2005, 03:42 PM   #5
Registered: Feb 2003
Distribution: VectorLinux 5.1
Posts: 116

Rep: Reputation: 15
GKrellM has a lot more configurability and can keep track of your usage over the course of a month or a week, regardless of restarts. Of course you could just as easily write up a script to keep a daily, weekly, and/or monthly total in a log somewhere.

Get creative, and be sure to let us know what you come up with.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
bandwidth monitoring,,,,, apenguinlinux Linux - Software 3 01-25-2005 10:19 AM
Bandwidth Monitoring basketkase999 Linux - Software 2 01-13-2005 02:44 PM
Bandwidth monitoring vinhhv Linux - Networking 8 07-21-2003 04:12 AM
Bandwidth Monitoring syntac Linux - Networking 2 04-08-2003 02:17 AM
Bandwidth Monitoring allandire Linux - Networking 1 06-25-2002 06:02 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:16 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration