SYNTAX

       du [ -abCdfFhiklLsStu ] [ -B size ] [ -U user ] [ -c n,...
       ] [ name ... ]


DESCRIPTION

       du calculates the disk usage of each  name  given  on  the
       command  line.   If name is a directory then it is scanned
       recursively and the accumulated disk usage of its contents
       is reported.  If no name is specified on the command line,
       then du reports the usage at the current directory.

       The default behavior of du is as follows.  When  a  direc­
       tory is given as the name on the command line, that direc­
       tory and its contents are scanned recursively.  This means
       the  command ``du /'' reports the disk usage on the entire
       system.  The disk usage is  displayed  at  each  directory
       encountered.  The displayed usage includes the accumulated
       contents of that directory.  The disk usage for a filesys­
       tem  entry  other than a directory (regular file, etc.) is
       not displayed, but it is accumulated into the usage of its
       parent directory.  This means that if the name on the com­
       mand line is not a directory (such  as  a  regular  file),
       then du does not display its usage.  Command line switches
       are available  to  modify  nearly  every  aspect  of  this
       default behavior.

       Disk usage is reported as a number of blocks.  The size of
       these blocks is site-specific, but usually is  either  512
       bytes or 1024 bytes.  Most installations allow you to give
       a preferred default setting in  an  environment  parameter
       typically  called ``BLOCKSIZE''.  Use the -h option to see
       how your version of du is configured.  There are a  number
       of  options  that  will  select a different block size for
       reporting disk usage.

       The term ``block'' has multiple meanings, and this can  be
       confusing.   The  du  program reports disk usage in chunks
       called ``blocks''.  The Unix  filesystem  stores  data  on
       disk  in chunks also called ``blocks''.  These are not the
       same thing, and, unfortunately, on most modern systems the
       sizes  of the two are different.  Once upon a time, a long
       time ago, the Unix filesystem storage block size  was  512
       bytes,  and  du  reported usage in 512-byte blocks.  These
       days, filesystem block sizes such as 1024 bytes  and  8192
       bytes  are  typical.   Nonetheless,  this  explains why du
       tends to use the seemingly unfortunate choice of 512 bytes
       for its reporting blocksize.

       The  du  program performs all of its internal calculations
       based upon the filesystem storage  block  size,  and  then
       scales the value to a reporting block size prior to print­
       ing.  This  means  that  the  calculations  are  accurate,
       regardless  of  the block sizes (filesystem or reporting),
       The disk usage calculated by du  takes  into  account  the
       ``indirect  block''  overhead  of  very  large files.  The
       usage for such files will be the space used by the  file's
       data  blocks  as  well  as  the overhead from any indirect
       address blocks.

       The following options modify the behavior of du:

       -a        The usage of all items is reported.  Normally du
                 displays  only  the  usage at directories.  When
                 this option  is  specified,  the  usage  of  all
                 filesystem  items  (regular  files, directories,
                 etc.)  encountered is displayed.

       -b        Report disk usage in number of bytes; equivalent
                 to  ``-B  1''.  Note that disk usage in bytes is
                 not the same thing as file  size.   A  one  byte
                 file  residing  on a 1K filesystem, for example,
                 has a disk usage of 1024 bytes and not 1 byte.

       -B size   The usage is reported  in  terms  of  size  byte
                 blocks  instead  of the default.  (The -h option
                 will tell you what this default  value  is.)   A
                 size  of  zero means use the physical filesystem
                 disk block size as  the  reporting  block  size.
                 Note  that  this  value is system dependant, and
                 can vary across different filesystems  upon  the
                 machine.

       -c n,...  The  disk  usage  will be broken down by age and
                 displayed in columns, one column for each  value
                 in  the  list.   Each  column shows the usage by
                 entries n days or older.  For example, the  com­
                 mand:

                      du -c 0,7,30

                 displays  the usage in three columns:  the total
                 usage (zero days or older), the usage by entries
                 a  week  or  older,  and  the usage by entries a
                 month or older.  The default behavior of  du  is
                 equivalent  to  ``-c 0''.  The age is based upon
                 an entry's time of last modification.

       -C        Displays a count of entries as well as the  disk
                 usage of those entries.  The count includes only
                 those items that participated in the disk  usage
                 calculation.  If, for example, the -u option (to
                 skip multiply-linked files) is  also  specified,
                 multiply-linked  files  will be omitted not only
                 from the usual usage calculations, but also  the
                 file count requested by the -C option.

       -f        This  option  will  prevent du from processing a

       -h        Displays  a  help  summary.   Also indicates the
                 default size of the disk blocks used in  report­
                 ing.

       -i        Do not accumulate subdirectories' usage into the
                 parent directory's usage.  If, for example,  you
                 run:

                      du -i comp/text

                 then   the   disk   usage   for  a  subdirectory
                 comp/text/desktop will not be  accumulated  into
                 the disk usage of comp/text.

       -k        Report disk usage in number of kilobytes; equiv­
                 alent to ``-B 1024''.

       -l        Normally du will  count  a  file  with  multiple
                 (hard)  links  only  once.  With this option, du
                 will count the file each time it is encountered.

       -L        Count  each instance of a multiply (hard) linked
                 regular file, but average the usage over each of
                 the  links.   If, for example, a 7 block file is
                 linked  to  the  names   comp/unix/questions/13,
                 comp/unix/programmer/12,  and alt/flame/33, then
                 du will count the file three times  with  usages
                 of 3, 2, and 2 blocks, respectively.

       -r        Traditionally,  the  du  program  does  its work
                 silently and will not report any errors, i.e.  a
                 name  specified  on  the  command  line  doesn't
                 exist, you don't have  permissions  to  check  a
                 directory,  etc.   This  version  of du normally
                 prints these errors to the  stderr  output.   It
                 can  be  configured,  however,  to be compatible
                 with the traditional behavior and suppress error
                 messages.   If  this is done, then the -r option
                 will be available to  enable  these  error  mes­
                 sages.   The  -h option will tell you whether or
                 not this option has been enabled.

       -s        Normally du reports  the  disk  usage  for  each
                 directory it encounters.  This option suppresses
                 that information  and  instead  reports  just  a
                 total  usage  for each of the items specified on
                 the command line.

       -S        This option is available only  on  systems  that
                 support symbolic links (symlinks).  Normally, du
                 accumulates the usage of the symlink itself  and
                 not  the  entry  to  which it points.  When this
                 option is specified, du  will  dereference  sym­
                 source  directory,  plus  a grand total of these
                 directories.

       -u        Causes  multiply  linked  files  to  be  skipped
                 entirely  and omitted from the usage statistics.

       -U user   Only entries owned by the indicated user will be
                 counted.  Either a username or UID number may be
                 specified.


ENVIRONMENT

       BLOCKSIZE
              Most installations allow the default  blocksize  to
              be specified in an environment parameter, typically
              called ``BLOCKSIZE''.  Run ``du -h'' to see if this
              option is enabled on your system and what parameter
              name is used.


SEE ALSO

       df(1), dusort(1L), ls(1), mount(8), stat(2)


BUGS

       Unlike some implementations of du, there is  no  limit  to
       the number of linked files that can be handled.

       Unless  your system provides an st_blocks in the inode, du
       will report files with holes in them (sparse files) incor­
       rectly.

       If  the  filesystem  storage block size is not an integral
       multiple of the reporting block size  (-B)  then  roundoff
       errors  will occur in the conversion.  du will round up in
       this case.

       By default, multiply linked files are counted  only  once,
       but  you  can't  be  sure  under  which directory they are
       counted.

       There is a compile-time option that  specifies  that  sym­
       links  given  on the command line should be followed, even
       when -S is not specified.  This feature may have been dis­
       abled on your installation.

       When  symlinks  are  dereferenced  with  the -S option, du
       still tries to ensure that entries are counted only  once.
       This   incurs  significant  overhead,  because  now  every
       filesystem entry (even directories)  must  be  checked  to
       avoid  duplicates.   (Normally,  only  files with multiple
       hard links are checked.)  These checks, as a side  effect,
       will  prevent  du from getting caught up in a loop of sym­
       links.  If the -l option (count all links) is specified as
       well,  the  check  is suppressed: entries are counted each
       time encountered, and symlink loops pose a hazard.  The -L
       option  to  average usage across links cannot be used when
       corrupted by the presence of hard links.  If, for example,
       /usr/foo/bar  and /usr/foo/baz are links to the same file,
       then the command ``du  /usr/foo  /usr''  will  report  the
       usage of directory /usr/foo twice, and the two values will
       not agree.  (The results get even  wierder  when  symlinks
       are dereferenced.)


AUTHOR

       Chip Rosenthal
       Unicom Systems Development.
       <chip@unicom.com>

       Copyright  1990-1997,  Unicom  Systems  Development.   All
       rights reserved.



                                                            DU(1)