/kernel_reloaded/

Author:

Other contacts

Novi članci

Flickr Goodness

Categories

July 24, 2012 @ 22:35

cli oneliner – sort top 10 directories

 
One simple oneliner that I picked up few years ago, and it is great for finding directories that eat up most of space in current directory.
 
ls -A | grep -v -e '^\.\.$' |xargs -i du -ks {} |sort -rn |head -11 | awk '{print $2}' | xargs -i du -hs {}
 

Filed under linux, tips&tricks

  • Tobias Florek

    what about

    du –max-depth 1 -h .|sort -rh|head -12

    it should perform quite better…

  • Doug

    You can shorten that a bit on systems where sort supports ‘-h’

    ls -A | grep -v -e ‘^\.\.$’ |xargs -i du -hs {} |sort -hr |head -11

  • foobar

    New versions of du and sort have ‘human’ so now all you need is:

    $ du -hxs ./* | sort -hr

  • http://ipozgaj.blogspot.com Igor Pozgaj

    The second command in the pipeline (excluding .. with grep) is superfluous as ls -A won’t include . and .. in files/directories listing (read the manpage).

    Archives

    Flickr photostream

    User not found

    Meta meta :)