I would like to do the Linux equivalent of du --max-depth=1 on Solaris.

I cannot find an equivalent in the man pages. Any alternatives?

  • Does find have a max-depth option on Solaris? Can you pipe that out to an xargs du? – mpbloch Aug 12 '09 at 16:27

Won't this do it?

du -s *
  • Yes, this works almost exactly like the Linux way, without a total count at the bottom, but I can use du -s . to get that one. I modified to du -sh * for a more readable output. Thanks! – kekoav Aug 12 '09 at 18:23

You could always install gnu fileutils and get the same functionality. Blastwave would have pre-built packages for newer versions of Solaris.

  • Good solution, I just needed something quick and dirty for now, thanks. – kekoav Aug 12 '09 at 18:25
  • 1
    Chances is that you have GNU du at /usr/gnu/bin/du. – Lester Cheung Aug 14 '09 at 2:48

Will this work on Solaris?

du | egrep -v '.*/.*/.*'

The du command included with OpenSolaris does support --max-depth!


find ./ -type d -print -maxdepth 1|xargs du -hs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.