/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).

    Recent Comments

    •  Tomáš Pavel: So I just solder it together and it works? That looks easy.
    • Valent Turkovic: NetVideoHunter (plugin) NetVideoHunter is a Firefox add-on (extension), and you can easily download...
    • Valent Turkovic: Also interesting, Google+ Share – https://addons.mozilla.org/en- US/firefox/addon/google-sha...
    • sf_jeff: Did you look under the “View” tab under the computer on the left?
    • blahmer anagas: set get fans at full speed hp linux, how can i set my fans to full speed on my hp 6530b 6730b? ^ just...

    Archives

    del.icio.us

    Flickr photostream

    User not found

    Meta meta :)