On Tue, May 13, 2014 at 1:07 AM, Dan Egli <[email protected]> wrote:
> I was goofing around and decided I'd write a quick script that calls
> ifconfig so as to determine how much bandwidth is being used (up and down
> stream) on average. I wound up with something that I think would work, but
> I'm wondering if I can't do it better.

Not a bad idea, but better than forking out to ifconfig, might be to
read from files in /proc.
Example:
awk '/^IpExt: [0-9]/{print $8 " " $9}' /proc/net/netstat
or
awk '/^IFACE/{print $2 " " $10}' /proc/net/dev
etc.

/*
PLUG: http://plug.org, #utah on irc.freenode.net
Unsubscribe: http://plug.org/mailman/options/plug
Don't fear the penguin.
*/

Reply via email to