Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Bar graph of file, folder sizes on TxD (See related posts)

From besonen.

Prints an ordered list of file and folder sizes in human readable form, with a bar graph to show the relative size of each item.

du -k | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf("%6.1f\t%s\t%25s  %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}'

Comments on this post

jamiew posts on Jan 07, 2007 at 01:09
du -k -d 1
(depth = 1) will give you a breakdown of the current dir without recursing, great for a quick overview

great snippet! thanks.

You need to create an account or log in to post comments to this site.


Related Posts