LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Blogs > sag47
User Name
Password

Notices

Rate this Entry

Network usage on a single device and log diving

Posted 09-27-2011 at 02:57 PM by sag47
Updated 09-29-2011 at 08:30 AM by sag47
Tags networking

I wanted to know the received network usage on a device in kB so this one liner was produced for the desired result.
Code:
while true; do y=`ifconfig eth0 | grep RX\ bytes| sed -e 's/.*bytes\://' -e 's/\ .*//'`; sleep 1; x=`ifconfig eth0 | grep RX\ bytes| sed -e 's/.*bytes\://' -e 's/\ .*//'`; echo $(((x-y)/1024)); done
Press Ctrl+C to stop analyzing the network traffic on that device.

Here's another one liner of me looking through multiple log locations.

Code:
for x in /fake1/logs/ /fake2/logs/;do find $x -type f -print0 | xargs -0 grep -iH 'search for something' | cut -d: -f1 | sort -u;done
Hell yea.
Posted in Uncategorized
Views 538 Comments 0
« Prev     Main     Next »
Total Comments 0

Comments

 

  



All times are GMT -5. The time now is 08:39 PM.

Main Menu

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration