/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

    • Francesco: this is for xbmc buttons #buttons Wiimote.A = KEY_ENTER Wiimote.B = KEY_BACKSPACE Wiimote.Up = KEY_UP...
    • Thiago: I can think of a Denver property management company or two that could stand to take a leaf out of...
    • Darko Markic: Google karta Hrvatske od sada se može preuzeti i ovdje: http://www.auto-karta-hrvat...
    • Valent Turkovic: 4GB CF card from Igor: Read: 18.3 MB/s Write: 18.3 MB/s
    • Valent Turkovic: Excellent article: http://blogofterje.wordpress.c om/2012/01/14/optimizing-fs-on -sd-card/

    Archives

    del.icio.us

    Flickr photostream

    Uma ótima tarde para todos..
    DSC00400_Snapseed
    P1120376.jpg
    WWR_3546-Edit-2
    _MG_3189
    DSC_1120
    _DSC8832.jpg
    CANAL (82 of 95).jpg
    2010_SV_Sommerfest_0273.JPG
    IMG_8471.JPG
    05 05 13 Keukenhof 024

    Meta meta :)