3

The du command in my solaris environment has very terse help, no man page, and doesn't support the --max-depth option seen in the linux world.

I want to know how much space a given directory occupies. What's the simplest way to get this in Solaris?

5
  • Found an answer. Rather than deleting the question, I figure someone else might like to know the answer: du -sk <dirname> Commented May 10, 2011 at 19:15
  • you can answer your own question then.
    – Nitrodist
    Commented May 10, 2011 at 19:56
  • To add to what @Nitrodist suggests: Please accept an answer or post your own and accept it once that is possible. This way, the system recognizes this issue as solved and doesn't bump it to the front page in the future.
    – Daniel Beck
    Commented May 10, 2011 at 20:35
  • I have to wait 8 hours before I can post an answer to my own question. Commented May 10, 2011 at 20:44
  • Solaris provides a du man page, but your sysadmin may have chosen not to install man pages. You can find them online at download.oracle.com/docs/cd/E19253-01/index.html
    – alanc
    Commented May 10, 2011 at 23:59

2 Answers 2

5
du -s <dirname>

... or to get it to print the size in kilobytes:

du -sk <dirname>

Additionally, if you have the right OpenCSW package(s) installed (who doesn't?), the GNU variants of this (and other tools) are available in /opt/csw/bin, often with a g tacked onto the front (gdu, gsed, gawk, etc). For example:

/opt/csw/bin/gdu --max-depth=0 <dirname>
0

Hack, but should work:

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

This will print only the lines with 2 or fewer '/' marks.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .