Wednesday, April 15, 2009

Shell commands collections

On the job, these are command I sometime use to make life easier or so. Feel free to add your own via comments or correct any of them...

Feed the list of all those empty files to the rm command one at a time, and you're done:
$ ls -tr |xargs -t -I{} rm -f {}

ls /var/log/*.[0-9]* | xargs gzip --best

What's eating /?
find / -xdev -ls | sort -n -k 7

recursive grep:

find . -type f -print | xargs -useful egrep -l foo

no truncate ps:

ps -auxwww

SUM USING BC:

awk '{ print "a = a + " $1 "; a" }' x.txt | bc -l | tail -1

Readers who read this page, also read:




Bookmark and Share My Zimbio http://www.wikio.com

0 comments: