Women in Technology

Hear us Roar



Hack:   Playing Hunt the Disk Hog
Subject:   another (better?) way to do this
Date:   2003-03-19 15:29:31
From:   anonymous2
du -x --max-depth=1 |sort -n



This will limit it to the current filesystem.
I think it will only work on GNU du

Full Threads Oldest First

Showing messages 1 through 7 of 7.

  • another (better?) way to do this
    2003-07-26 16:23:13  anonymous2 [View]

    Or:
    ls -a | grep -v -e '^\.\+$' | xargs -i du -cks {} |sort -rn |head -11

    or even:
    ls -a | grep -v -e '^\.\.$' | xargs -i du -cks {} |sort -rn |head -11
    which has the nice side effect of showing the total size of the directory (obviously the contents of the directory are bigger than the largest file in the directory).
    • another (better?) way to do this
      2003-07-26 16:23:31  anonymous2 [View]

      Opps - take off the -c in du in the above.
      ls -a | grep -v -e '^\.\.$' | xargs -i du -ks {} |sort -rn |head -11
      • another (better?) way to do this
        2003-12-23 03:45:20  anonymous2 [View]

        Maybe you will like this one.
        ls -A don't show the current and parent directory (.&..) so "du" don't go up.

        ls -A | grep -v -e '^\.\.$' |xargs -i du -ks {} |sort -rn |head -11 | awk '{print $2}' | xargs -i du -hs {}
      • another (better?) way to do this
        2003-12-23 03:43:34  anonymous2 [View]

        Maybe you will like this one.
        ls -A don't show the current and parent directory (; &..) su du don't go up.

        ls -A | grep -v -e '^\.\.$' |xargs -i du -ks {} |sort -rn |head -11 | awk '{print $2}' | xargs -i du -hs {}
        • another (better?) way to do this
          2004-09-16 12:16:56  kj6loh [View]

          Actually, I don't understand the need for the second xargs? This is from my alias list
          alias dh='ls -a | grep -v -e '\''^\.\.$'\'' |xargs -i du -s {} |sort -nr |sed -n '\''2,$p'\''|head'
          Not quite the same but very similar. If you really want the h put it in after the du. Oh you'll probably have to escape the last dollar sign.
  • another (better?) way to do this
    2003-05-12 11:05:22  anonymous2 [View]

    I would agree that this is better, as this version will catch dotfiles and dotdirectories, while the book one will not.

    I had completely missed that my .wine directory was taking up the lions share of my home directory with my usual "du -s * | sort -rn | head" command.
  • another (better?) way to do this
    2003-03-28 14:48:48  anonymous2 [View]

    And then call it what? 'dux'? ;-)

Showing messages 1 through 7 of 7.