coreutils: du invocation

1 
1 14.2 ‘du’: Estimate file space usage
1 ====================================
1 
1 ‘du’ reports the amount of disk space used by the set of specified files
1 and for each subdirectory (of directory arguments).  Synopsis:
1 
1      du [OPTION]... [FILE]...
1 
1    With no arguments, ‘du’ reports the disk space for the current
1 directory.  Normally the disk space is printed in units of 1024 bytes,
1 but this can be overridden (⇒Block size).  Non-integer quantities
1 are rounded up to the next higher unit.
1 
1    If two or more hard links point to the same file, only one of the
1 hard links is counted.  The FILE argument order affects which links are
1 counted, and changing the argument order may change the numbers and
1 entries that ‘du’ outputs.
1 
11    The program accepts the following options.  Also see ⇒Common
 options.
1 
1 ‘-0’
1 ‘--null’
1      Output a zero byte (ASCII NUL) at the end of each line, rather than
1      a newline.  This option enables other programs to parse the output
1      even when that output would contain data with embedded newlines.
1 
1 ‘-a’
1 ‘--all’
1      Show counts for all files, not just directories.
1 
1 ‘--apparent-size’
1      Print apparent sizes, rather than disk usage.  The apparent size of
1      a file is the number of bytes reported by ‘wc -c’ on regular files,
1      or more generally, ‘ls -l --block-size=1’ or ‘stat --format=%s’.
1      For example, a file containing the word ‘zoo’ with no newline
1      would, of course, have an apparent size of 3.  Such a small file
1      may require anywhere from 0 to 16 KiB or more of disk space,
1      depending on the type and configuration of the file system on which
1      the file resides.  However, a sparse file created with this
1      command:
1 
1           dd bs=1 seek=2GiB if=/dev/null of=big
1 
1      has an apparent size of 2 GiB, yet on most modern systems, it
1      actually uses almost no disk space.
1 
1 ‘-B SIZE’
1 ‘--block-size=SIZE’
1      Scale sizes by SIZE before printing them (⇒Block size).  For
1      example, ‘-BG’ prints sizes in units of 1,073,741,824 bytes.
1 
1 ‘-b’
1 ‘--bytes’
1      Equivalent to ‘--apparent-size --block-size=1’.
1 
1 ‘-c’
1 ‘--total’
1      Print a grand total of all arguments after all arguments have been
1      processed.  This can be used to find out the total disk usage of a
1      given set of files or directories.
1 
1 ‘-D’
1 ‘--dereference-args’
1      Dereference symbolic links that are command line arguments.  Does
1      not affect other symbolic links.  This is helpful for finding out
1      the disk usage of directories, such as ‘/usr/tmp’, which are often
1      symbolic links.
1 
1 ‘-d DEPTH’
1 ‘--max-depth=DEPTH’
1      Show the total for each directory (and file if –all) that is at
1      most MAX_DEPTH levels down from the root of the hierarchy.  The
1      root is at level 0, so ‘du --max-depth=0’ is equivalent to ‘du -s’.
1 
1 ‘--files0-from=FILE’
1      Disallow processing files named on the command line, and instead
1      process those named in file FILE; each name being terminated by a
1      zero byte (ASCII NUL). This is useful when the list of file names
1      is so long that it may exceed a command line length limitation.  In
1      such cases, running ‘du’ via ‘xargs’ is undesirable because it
1      splits the list into pieces and makes ‘du’ print with the ‘--total’
1      (‘-c’) option for each sublist rather than for the entire list.
1      One way to produce a list of ASCII NUL terminated file names is
1      with GNU ‘find’, using its ‘-print0’ predicate.  If FILE is ‘-’
1      then the ASCII NUL terminated file names are read from standard
1      input.
1 
1 ‘-H’
1      Equivalent to ‘--dereference-args’ (‘-D’).
1 
1 ‘-h’
1 ‘--human-readable’
1      Append a size letter to each size, such as ‘M’ for mebibytes.
1      Powers of 1024 are used, not 1000; ‘M’ stands for 1,048,576 bytes.
1      This option is equivalent to ‘--block-size=human-readable’.  Use
1      the ‘--si’ option if you prefer powers of 1000.
1 
1 ‘--inodes’
1      List inode usage information instead of block usage.  This option
1      is useful for finding directories which contain many files, and
1      therefore eat up most of the inodes space of a file system (see
1      ‘df’, option ‘--inodes’).  It can well be combined with the options
1      ‘-a’, ‘-c’, ‘-h’, ‘-l’, ‘-s’, ‘-S’, ‘-t’ and ‘-x’; however, passing
1      other options regarding the block size, for example ‘-b’, ‘-m’ and
1      ‘--apparent-size’, is ignored.
1 
1 ‘-k’
1      Print sizes in 1024-byte blocks, overriding the default block size
1      (⇒Block size).  This option is equivalent to
1      ‘--block-size=1K’.
1 
1 ‘-L’
1 ‘--dereference’
1      Dereference symbolic links (show the disk space used by the file or
1      directory that the link points to instead of the space used by the
1      link).
1 
1 ‘-l’
1 ‘--count-links’
1      Count the size of all files, even if they have appeared already (as
1      a hard link).
1 
1 ‘-m’
1      Print sizes in 1,048,576-byte blocks, overriding the default block
1      size (⇒Block size).  This option is equivalent to
1      ‘--block-size=1M’.
1 
1 ‘-P’
1 ‘--no-dereference’
1      For each symbolic links encountered by ‘du’, consider the disk
1      space used by the symbolic link.
1 
1 ‘-S’
1 ‘--separate-dirs’
1      Normally, in the output of ‘du’ (when not using ‘--summarize’), the
1      size listed next to a directory name, D, represents the sum of
1      sizes of all entries beneath D as well as the size of D itself.
1      With ‘--separate-dirs’, the size reported for a directory name, D,
1      will exclude the size of any subdirectories.
1 
1 ‘--si’
1      Append an SI-style abbreviation to each size, such as ‘M’ for
1      megabytes.  Powers of 1000 are used, not 1024; ‘M’ stands for
1      1,000,000 bytes.  This option is equivalent to ‘--block-size=si’.
1      Use the ‘-h’ or ‘--human-readable’ option if you prefer powers of
1      1024.
1 
1 ‘-s’
1 ‘--summarize’
1      Display only a total for each argument.
1 
1 ‘-t SIZE’
1 ‘--threshold=SIZE’
1      Exclude entries based on a given SIZE.  The SIZE refers to used
1      blocks in normal mode (⇒Block size), or inodes count in
1      conjunction with the ‘--inodes’ option.
1 
1      If SIZE is positive, then ‘du’ will only print entries with a size
1      greater than or equal to that.
1 
1      If SIZE is negative, then ‘du’ will only print entries with a size
1      smaller than or equal to that.
1 
1      Although GNU ‘find’ can be used to find files of a certain size,
1      ‘du’’s ‘--threshold’ option can be used to also filter directories
1      based on a given size.
1 
1      Please note that the ‘--threshold’ option can be combined with the
1      ‘--apparent-size’ option, and in this case would elide entries
1      based on its apparent size.
1 
1      Please note that the ‘--threshold’ option can be combined with the
1      ‘--inodes’ option, and in this case would elide entries based on
1      its inodes count.
1 
1      Here’s how you would use ‘--threshold’ to find directories with a
1      size greater than or equal to 200 megabytes:
1 
1           du --threshold=200MB
1 
1      Here’s how you would use ‘--threshold’ to find directories and
1      files - note the ‘-a’ - with an apparent size smaller than or equal
1      to 500 bytes:
1 
1           du -a -t -500 --apparent-size
1 
1      Here’s how you would use ‘--threshold’ to find directories on the
1      root file system with more than 20000 inodes used in the directory
1      tree below:
1 
1           du --inodes -x --threshold=20000 /
1 
1 ‘--time’
1      Show the most recent modification timestamp (mtime) of any file in
11      the directory, or any of its subdirectories.  ⇒File
      timestamps.
1 
1 ‘--time=ctime’
1 ‘--time=status’
1 ‘--time=use’
1      Show the most recent status change timestamp (ctime) of any file in
11      the directory, or any of its subdirectories.  ⇒File
      timestamps.
1 
1 ‘--time=atime’
1 ‘--time=access’
1      Show the most recent access timestamp (atime) of any file in the
1      directory, or any of its subdirectories.  ⇒File timestamps.
1 
1 ‘--time-style=STYLE’
1      List timestamps in style STYLE.  This option has an effect only if
1      the ‘--time’ option is also specified.  The STYLE should be one of
1      the following:
1 
1      ‘+FORMAT’
1           List timestamps using FORMAT, where FORMAT is interpreted like
1           the format argument of ‘date’ (⇒date invocation).  For
1           example, ‘--time-style="+%Y-%m-%d %H:%M:%S"’ causes ‘du’ to
1           list timestamps like ‘2002-03-30 23:45:56’.  As with ‘date’,
1           FORMAT’s interpretation is affected by the ‘LC_TIME’ locale
1           category.
1 
1      ‘full-iso’
1           List timestamps in full using ISO 8601-like date, time, and
1           time zone components with nanosecond precision, e.g.,
1           ‘2002-03-30 23:45:56.477817180 -0700’.  This style is
1           equivalent to ‘+%Y-%m-%d %H:%M:%S.%N %z’.
1 
1      ‘long-iso’
1           List ISO 8601 date and time components with minute precision,
1           e.g., ‘2002-03-30 23:45’.  These timestamps are shorter than
1           ‘full-iso’ timestamps, and are usually good enough for
1           everyday work.  This style is equivalent to ‘+%Y-%m-%d %H:%M’.
1 
1      ‘iso’
1           List ISO 8601 dates for timestamps, e.g., ‘2002-03-30’.  This
1           style is equivalent to ‘+%Y-%m-%d’.
1 
1      You can specify the default value of the ‘--time-style’ option with
1      the environment variable ‘TIME_STYLE’; if ‘TIME_STYLE’ is not set
1      the default style is ‘long-iso’.  For compatibility with ‘ls’, if
1      ‘TIME_STYLE’ begins with ‘+’ and contains a newline, the newline
1      and any later characters are ignored; if ‘TIME_STYLE’ begins with
1      ‘posix-’ the ‘posix-’ is ignored; and if ‘TIME_STYLE’ is ‘locale’
1      it is ignored.
1 
1 ‘-X FILE’
1 ‘--exclude-from=FILE’
1      Like ‘--exclude’, except take the patterns to exclude from FILE,
1      one per line.  If FILE is ‘-’, take the patterns from standard
1      input.
1 
1 ‘--exclude=PATTERN’
1      When recursing, skip subdirectories or files matching PATTERN.  For
1      example, ‘du --exclude='*.o'’ excludes files whose names end in
1      ‘.o’.
1 
1 ‘-x’
1 ‘--one-file-system’
1      Skip directories that are on different file systems from the one
1      that the argument being processed is on.
1 
1    On BSD systems, ‘du’ reports sizes that are half the correct values
1 for files that are NFS-mounted from HP-UX systems.  On HP-UX systems, it
1 reports sizes that are twice the correct values for files that are
1 NFS-mounted from BSD systems.  This is due to a flaw in HP-UX; it also
1 affects the HP-UX ‘du’ program.
1 
1    An exit status of zero indicates success, and a nonzero value
1 indicates failure.
1