LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-06-2008, 10:47 PM   #1
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,126
Blog Entries: 2

Rep: Reputation: 260Reputation: 260Reputation: 260
grep current rx and tx speed


Is there a command I can use with grep to get the current rx and tx speeds in terminal without root privileges?
 
Old 02-06-2008, 11:50 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
rx and tx speeds of what?

If you mean a wireless interface, iwconfig should show that to you, even as non-root.
 
Old 02-07-2008, 01:28 AM   #3
Angel2953
Member
 
Registered: Sep 2005
Location: Poland
Distribution: Debian, Ubuntu
Posts: 38

Rep: Reputation: 16
Run something like this:
Code:
/sbin/ifconfig eth0 | grep 'TX bytes'
Result on RHEL:
Code:
$ /sbin/ifconfig eth0 | grep 'TX bytes'
          RX bytes:6379743404 (5.9 GiB)  TX bytes:16551093106 (15.4 GiB)
==============================
Edit:
sorry, my bad...

Last edited by Angel2953; 02-07-2008 at 05:57 AM.
 
Old 02-07-2008, 05:17 AM   #4
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,126

Original Poster
Blog Entries: 2

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by Angel2953 View Post
Run something like this:
Code:
/sbin/ifconfig eth0 | grep 'TX bytes'
Result on RHEL:
Code:
$ /sbin/ifconfig eth0 | grep 'TX bytes'
          RX bytes:6379743404 (5.9 GiB)  TX bytes:16551093106 (15.4 GiB)
That's not what I'm looking for, that's the total rx / tx bytes downloaded, unless my laptop is downloading at 68.8 GiB/s. I'm looking for the download rate. Like when I'm downloading a file, I wanna be able to grep the rate the file is downloading at.

slurm -i eth0 shows me this, but I can't grep the output.

Last edited by replica9000; 02-07-2008 at 05:20 AM.
 
Old 02-07-2008, 02:46 PM   #5
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,126

Original Poster
Blog Entries: 2

Rep: Reputation: 260Reputation: 260Reputation: 260
The reason I want to do this is I use SuperKaramba to monitor my network speed. But it greatly exaggerates the actual speed (by about 10x), even on multiple machines.

I was looking to replace this line in my .theme file:
Code:
sensor=network format="%inkb Kbps" device="eth1"
With something similar to this:
Code:
sensor=program program="slurm -i eth1 | grep 'Current TX Speed' cut -d ' ' -f20,21" interval=1000
Except like I said grep doesn't work with slurm, and ifconfig only gives the total downloaded or uploaded.
 
Old 02-07-2008, 03:31 PM   #6
Angel2953
Member
 
Registered: Sep 2005
Location: Poland
Distribution: Debian, Ubuntu
Posts: 38

Rep: Reputation: 16
then try ethstats it's a perl script that reads /proc/net/dev and print out in/out speed i MB/s. Maybe by analyzing this script you can develop you own...

Last edited by Angel2953; 02-07-2008 at 03:42 PM.
 
Old 02-07-2008, 03:35 PM   #7
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Are you looking for speed in KBps instead of Kbps? That might be the issue.
 
Old 02-07-2008, 03:42 PM   #8
Angel2953
Member
 
Registered: Sep 2005
Location: Poland
Distribution: Debian, Ubuntu
Posts: 38

Rep: Reputation: 16
ok, i've foun what you have been looking for ^_^ it's vnstat but it has a 5 sec delay T_T... and i wrote simple line to get rates ^_^:

Code:
dawid@rei:~$ vnstat -i eth0 -tr
1008 packets sampled in 5 seconds
Traffic average for eth0

      rx          37.57 kB/s             87 packets/s
      tx         136.29 kB/s            114 packets/s

dawid@rei:~$ vnstat -i eth0 -tr | grep rx
      rx          44.85 kB/s             93 packets/s
dawid@rei:~$ vnstat -i eth0 -tr | grep tx
      tx         124.51 kB/s            115 packets/s
dawid@rei:~$ vnstat -i eth0 -tr | grep rx | awk '{print "RX rate: " $2 " " $3}'
RX rate: 62.18 kB/s
dawid@rei:~$ vnstat -i eth0 -tr | grep tx | awk '{print "TX rate: " $2 " " $3}'
TX rate: 120.54 kB/s
dawid@rei:~$ vnstat -i eth0 -tr | grep rx | awk '{print "RX rate: " $2 " " $3 " (packets: " $4 ")"}'
RX rate: 40.00 kB/s (packets: 81)
dawid@rei:~$ vnstat -i eth0 -tr | grep tx | awk '{print "TX rate: " $2 " " $3 " (packets: " $4 ")"}'
TX rate: 125.81 kB/s (packets: 125)
dawid@rei:~$
maybe this can help you...
 
Old 02-07-2008, 04:04 PM   #9
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,126

Original Poster
Blog Entries: 2

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by Matir View Post
Are you looking for speed in KBps instead of Kbps? That might be the issue.
Yes that was the issue!
I looked into the SuperKaramba options and found out that %outkb=kilobits/sec and %out=kilobytes/sec

Thanks!
 
Old 02-07-2008, 04:07 PM   #10
replica9000
Senior Member
 
Registered: Jul 2006
Distribution: Debian Unstable
Posts: 1,126

Original Poster
Blog Entries: 2

Rep: Reputation: 260Reputation: 260Reputation: 260
Quote:
Originally Posted by Angel2953 View Post
ok, i've foun what you have been looking for ^_^ it's vnstat but it has a 5 sec delay T_T... and i wrote simple line to get rates ^_^:

Code:
dawid@rei:~$ vnstat -i eth0 -tr
1008 packets sampled in 5 seconds
Traffic average for eth0

      rx          37.57 kB/s             87 packets/s
      tx         136.29 kB/s            114 packets/s

dawid@rei:~$ vnstat -i eth0 -tr | grep rx
      rx          44.85 kB/s             93 packets/s
dawid@rei:~$ vnstat -i eth0 -tr | grep tx
      tx         124.51 kB/s            115 packets/s
dawid@rei:~$ vnstat -i eth0 -tr | grep rx | awk '{print "RX rate: " $2 " " $3}'
RX rate: 62.18 kB/s
dawid@rei:~$ vnstat -i eth0 -tr | grep tx | awk '{print "TX rate: " $2 " " $3}'
TX rate: 120.54 kB/s
dawid@rei:~$ vnstat -i eth0 -tr | grep rx | awk '{print "RX rate: " $2 " " $3 " (packets: " $4 ")"}'
RX rate: 40.00 kB/s (packets: 81)
dawid@rei:~$ vnstat -i eth0 -tr | grep tx | awk '{print "TX rate: " $2 " " $3 " (packets: " $4 ")"}'
TX rate: 125.81 kB/s (packets: 125)
dawid@rei:~$
maybe this can help you...
Thanks for this info also, might help me with other things down the road.
 
  


Reply



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
how to grep multiple filters with grep LinuxLover Linux - Enterprise 1 10-18-2007 07:12 AM
Boot up speed -current (dhcpcd hanging) dive Slackware 6 05-22-2007 01:02 AM
Detect my true CPU rating (NOT the current speed) qwijibow Linux - Hardware 5 11-16-2004 08:53 PM
Speed up grep? J_Szucs Programming 15 10-31-2004 09:10 PM
ps -ef|grep -v root|grep apache<<result maelstrombob Linux - Newbie 1 09-24-2003 11:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:11 AM.

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