Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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

5 Answers 5

up vote 6 down vote accepted

Won't this do it?

cd $TOP_LEVEL_DIR
du -s *
share|improve this answer
    
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.

share|improve this answer
    
Good solution, I just needed something quick and dirty for now, thanks. –  kekoav Aug 12 '09 at 18:25
    
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 '.*/.*/.*'
share|improve this answer

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

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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