LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Blogs
User Name
Password

Notices


Old

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.
...
Senior Member
Posted in Uncategorized
Views 1888 Comments 0 sag47 is offline
Old

Simulate -print0 with ls

Posted 09-07-2011 at 03:39 AM by sag47
Tags find

Recently I wanted to manipulate files only in the current directory (not sub-directories). I usually use the following combination...

Code:
find . -type f -print0 | xargs -0 somecommand
The only problem I had with that was it ran through all sub-directories as well. Then I remembered the -m switch for ls and decided to depend on my good old friend sed.

Code:
ls -m | sed 's/, /\x0/g' | xargs -0 somecommand
Though I guess it would be better to do it...
Senior Member
Posted in Uncategorized
Views 4260 Comments 0 sag47 is offline
Old

rsync commands and how I backup

Posted 06-23-2011 at 05:06 PM by sag47
Updated 06-23-2011 at 05:07 PM by sag47

I run the following command when I want to just update one directory to another. It only copies files that have changed. If any files have been deleted from A they still exists in directory B. The trailing slash after A/ is necessary to tell rsync to move the contents. Otherwise A will create a folder in B called /media/B/A and move the files over.

Code:
rsync -ruptv /media/A/ /media/B
I run the following command when I want to mirror one directory to another. Any files...
Senior Member
Posted in Uncategorized
Views 2237 Comments 0 sag47 is offline
Old

Convert and resize images using imagemagick

Posted 05-30-2011 at 10:07 PM by sag47
Updated 05-31-2011 at 01:23 AM by sag47

This past memorial day weekend I took a bunch of pictures which I wanted to post to the web. Web photos are best viewed in 800x600px and I had a lot of them. So I used a simple command to do it.
Code:
for x in `ls -1`;do convert -resize 800x600 $x `echo $x | sed 's/.JPG/.png/'`;done
mkdir web_album
for x in `ls -1 *.png`;do convert $x web_album/`echo $x | sed 's/.png/.jpg/'`;done
rm *.png
Now I don't have to spend all my time in Gimp with that simple batch command.
Senior Member
Posted in Uncategorized
Views 7807 Comments 1 sag47 is offline
Old

DVD Ripping

Posted 04-25-2011 at 10:54 AM by sag47

I work for a Scientific Institution and a company which recorded talks decided to give us all the talks in DVD format instead of a hard drive full of video files. This is kind of counter intuitive however luckily I use Linux at work. Long story short mencoder with lame installed solved my problems.

Code:
mencoder 
-vf harddup 
-vf-add smartblur=.6:-.5:0,unsharp=l5x5:.8:c5x5:.4 
-xvidencopts fixed_quant=4:profile=dxnhtntsc 
-lameopts cbr:br=128:aq=0:vol=1
...
Senior Member
Posted in Uncategorized
Views 6735 Comments 1 sag47 is offline

  



All times are GMT -5. The time now is 01:26 AM.

Main Menu
Advertisement
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