(coreutils.info)du invocation


Next: stat invocation Prev: df invocation Up: Disk usage
Enter node , (file) or (file)node

14.2 `du': Estimate file space usage
====================================

`du' reports the amount of disk space used by the specified files and
for each subdirectory (of directory arguments).  Synopsis:

     du [OPTION]... [FILE]...

   With no arguments, `du' reports the disk space for the current
directory.  Normally the disk space is printed in units of 1024 bytes,
but this can be overridden (Note: Block size).  Non-integer
quantities are rounded up to the next higher unit.

   The program accepts the following options.  Also see Note: Common
options.

`-a'
`--all'
     Show counts for all files, not just directories.

`--apparent-size'
     Print apparent sizes, rather than disk usage.  The apparent size
     of a file is the number of bytes reported by `wc -c' on regular
     files, or more generally, `ls -l --block-size=1' or `stat
     --format=%s'.  For example, a file containing the word `zoo' with
     no newline would, of course, have an apparent size of 3.  Such a
     small file may require anywhere from zero to 16 or more kilobytes
     of disk space, depending on the type and configuration of the file
     system on which the file resides.  However, a sparse file created
     with this command
          : | dd bs=1 seek=`echo '2^31'|bc` of=big
     has an apparent size of 2 gigabytes, yet on most modern systems,
     it actually uses almost no disk space.

`-b'
`--bytes'
     Equivalent to `--apparent-size --block-size=1'.

`-B SIZE'
`--block-size=SIZE'
     Scale sizes by SIZE before printing them (Note: Block size).
     For example, `-BG' prints sizes in units of 1,073,741,824 bytes.

`-c'
`--total'
     Print a grand total of all arguments after all arguments have been
     processed.  This can be used to find out the total disk usage of a
     given set of files or directories.

`-D'
`--dereference-args'
     Dereference symbolic links that are command line arguments.  Does
     not affect other symbolic links.  This is helpful for finding out
     the disk usage of directories, such as `/usr/tmp', which are often
     symbolic links.

`-h'
`--human-readable'
     Append a size letter to each size, such as `M' for mebibytes.
     Powers of 1024 are used, not 1000; `M' stands for 1,048,576 bytes.
     Use the `--si' option if you prefer powers of 1000.

`-H'
     Currently, `-H' is the same as `--si', except that `-H' evokes a
     warning.  This option will be changed to be equivalent to
     `--dereference-args' (`-D').

`-k'
     Print sizes in 1024-byte blocks, overriding the default block size
     (Note: Block size).  This option is equivalent to
     `--block-size=1K'.

`-l'
`--count-links'
     Count the size of all files, even if they have appeared already
     (as a hard link).

`-L'
`--dereference'
     Dereference symbolic links (show the disk space used by the file
     or directory that the link points to instead of the space used by
     the link).

`-P'
`--no-dereference'
     For each symbolic links encountered by `du', consider the disk
     space used by the symbolic link.

`--max-depth=DEPTH'
     Show the total for each directory (and file if -all) that is at
     most MAX_DEPTH levels down from the root of the hierarchy.  The
     root is at level 0, so `du --max-depth=0' is equivalent to `du -s'.

`-0'
`--null'
     Output the zero byte (`NUL') at the end of each line, rather than
     a newline.  This option enables other programs to parse the output
     of `du' even when that output would contain file names with
     embedded newlines.

`--si'
     Append an SI-style abbreviation to each size, such as `MB' for
     megabytes.  Powers of 1000 are used, not 1024; `MB' stands for
     1,000,000 bytes.  Use the `-h' or `--human-readable' option if you
     prefer powers of 1024.

`-s'
`--summarize'
     Display only a total for each argument.

`-S'
`--separate-dirs'
     Report the size of each directory separately, not including the
     sizes of subdirectories.

`-x'
`--one-file-system'
     Skip directories that are on different filesystems from the one
     that the argument being processed is on.

`--exclude=PATTERN'
     When recursing, skip subdirectories or files matching PATTERN.
     For example, `du --exclude='*.o'' excludes files whose names end
     in `.o'.

`-X FILE'
`--exclude-from=FILE'
     Like `--exclude', except take the patterns to exclude from FILE,
     one per line.  If FILE is `-', take the patterns from standard
     input.


   On BSD systems, `du' reports sizes that are half the correct values
for files that are NFS-mounted from HP-UX systems.  On HP-UX systems,
it reports sizes that are twice the correct values for files that are
NFS-mounted from BSD systems.  This is due to a flaw in HP-UX; it also
affects the HP-UX `du' program.

   An exit status of zero indicates success, and a nonzero value
indicates failure.


automatically generated by info2www.cgi version 1.2.2.9