Top First 4 Lines To A File

Thursday, July 30, 2009

If the first 4 lines details of top command needs to be logged to a output file with time interval use this shell command

top -b -d 2 | grep "top -" -A 4 > /tmp/output_file

Explanation :

top -b : send results to output with default time interval
top -d 2 : refresh top every 2 seconds
grep "top -" : grep the very first line of top output. ( It has the work "top -")
grep -A 4 : prints only 4 lines after first line

Read more...

How To Sort Files By Extension - Linux

Wednesday, July 29, 2009

To list files by extension use this command

ll -X

if ll doesn't support use this one

ls -lX

Read more...

List Sub Directories Size In Linux

Tuesday, July 28, 2009

Go to the particular directory which sub-directories should be listed with size.

Then type this command,

du -cskh *

P.S : du -sh command prints the size of the directory itself

Read more...

About This Blog

  © Blogger template Writer's Blog by Ourblogtemplates.com 2008

Back to TOP