Disk size commands

find . -type f -size +20000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }' | sort -rn
du -mh --max-depth=2 | sort -nr | head -100
du -x | sort -nr | head -10
du -x --block-size=1024K | sort -nr | head -10
df -H
df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }'
df -H | grep -vE '^Filesystem|tmpfs|cdrom'
du -h --max-depth=1
du -sh
du -kh kb
du -mh megs

and my all time favorite:

du -sk ./* | sort -nr | awk 'BEGIN{ pref[1]="K"; pref[2]="M"; pref[3]="G";} { total = total + $1; x = $1; y = 1; while( x > 1024 ) { x = (x + 1023)/1024; y++; } printf("%g%s\t%s\n",int(x*10)/10,pref[y],$2); } END { y = 1; while( total > 1024 ) { total = (total + 1023)/1024; y++; } printf("Total: %g%s\n",int(total*10)/10,pref[y]); }'

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.