This is ugly, but it works great! I got it from www.shell-fu.org, so not taking credit for someone elses work. I created an alias in my .bashrc called dux to implement this trick. Copy this code:
alias dux='du -sk ./* | sort -n | 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(x10)/10,pref[y],$2); } END { y = 1; w hile( total > 1024 ) { total = (total + 1023)/1024; y++; } printf("Total: %g%s\n",int(total10)/10,pref[y]); }''''
alias dux='du -sk ./* | sort -n | 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]); }'\''' Yes, its very long, but it produces a human readable, sorted from smallest to largest output, toso when you are looking for whatswhat's taking up all the space, the answers are right above your cursor when it finishes. Give
Example:
Give it a try, I love it!
