View Single Post
Posts: 26 | Thanked: 39 times | Joined on Jul 2012 @ Bulgaria
#2392
Originally Posted by moudy91 View Post
a question.
/sbin/ifconfig wlan0 | grep bytes will grep bytes right???
can i grep /sbin/ifconfig wlan0 | grep bytes in MB ????
RX Traffic
/sbin/ifconfig | grep -A5 wlan0 | grep bytes | grep RX | awk '{print $6,$7}'
TX Traffic
/sbin/ifconfig | grep -A5 wlan0 | grep bytes | grep TX | awk '{print $6,$7}'

Add: | tr "(" " " | tr ")" " "
to remove the ( ) , or use 'cut' to do it.
The other thing you can do it get the data from /proc/net/dev
For RX:
RX=`grep wlan0 /proc/net/dev | awk '{print $2}'`;expr $RX / 1024 / 1024
For TX:
TX=`grep wlan0 /proc/net/dev | awk '{print $9}'`;expr $TX / 1024 / 1024

p.s. counters in /proc/net/dev are 32bit values, so they overflow from time, but I doubt you do so much traffic on you phone , so shoud work for u.