Print this page
7967 Want apparent size option for du(1)
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Peter Tribble <peter.tribble@gmail.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
   1 DU(1)                            User Commands                           DU(1)
   2 
   3 
   4 
   5 NAME
   6        du - summarize disk usage
   7 
   8 SYNOPSIS
   9        /usr/bin/du [-dorx] [-a | -s] [-h | -k | -m] [-H | -L]
  10             [file ...]
  11 
  12 
  13        /usr/xpg4/bin/du [-dorx] [-a | -s] [-h | -k | -m] [-H | -L]
  14             [file ...]
  15 
  16 
  17 DESCRIPTION
  18        The du utility writes to standard output the size of the file space
  19        allocated to, and the size of the file space allocated to each
  20        subdirectory of, the file hierarchy rooted in each of the specified
  21        files. The size of the file space allocated to a file of type directory
  22        is defined as the sum total of space allocated to all files in the file
  23        hierarchy rooted in the directory plus the space allocated to the
  24        directory itself. This sum will include the space allocated to any
  25        extended attributes encountered.
  26 
  27 
  28        Files with multiple links will be counted and written for only one
  29        entry. The directory entry that is selected in the report is
  30        unspecified. By default, file sizes are written in 512-byte units,
  31        rounded up to the next 512-byte unit.
  32 
  33    /usr/xpg4/bin/du
  34        When du cannot obtain file attributes or read directories (see
  35        stat(2)), it will report an error condition and the final exit status
  36        will be affected.
  37 
  38 OPTIONS
  39        The following options are supported for /usr/bin/du and
  40        /usr/xpg4/bin/du:
  41 
  42        -a
  43              In addition to the default output, report the size of each file
  44              not of type directory in the file hierarchy rooted in the
  45              specified file. Regardless of the presence of the -a option, non-
  46              directories given as file operands will always be listed.
  47 
  48 







  49        -d
  50              Do not cross filesystem boundaries. For example, the command, du
  51              -d / reports usage only on the root partition.
  52 
  53 
  54        -h
  55              All sizes are scaled to a human readable format, for example,
  56              14K, 234M, 2.7G, or 3.0T. Scaling is done by repetitively
  57              dividing by 1024.
  58 
  59 
  60        -H
  61              If a symbolic link to a directory is specified on the command
  62              line, process the symbolic link by using the directory which the
  63              symbolic link references, rather than the link itself.
  64 
  65 
  66        -k
  67              Write the files sizes in units of 1024 bytes, rather than the
  68              default 512-byte units.


 103              the same device as the file specified by the file operand.
 104 
 105 
 106 
 107        Specifying more than one of the options in the mutually exclusive pair,
 108        -H and -L, is not considered an error. The last option specified
 109        determines the output format.
 110 
 111 
 112        Specifying more than one of the options in the mutually exclusive set
 113        of options -h, -k, and -m is not considered an error.  The last option
 114        specified determines the output format.
 115 
 116 OPERANDS
 117        The following operand is supported:
 118 
 119        file
 120                The path name of a file whose size is to be written. If no file
 121                is specified, the current directory is used.
 122 
 123 
 124 OUTPUT
 125        The output from du consists of the amount of the space allocated to a
 126        file and the name of the file.
 127 
 128 USAGE
 129        See largefile(5) for the description of the behavior of du when
 130        encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
 131 
 132 ENVIRONMENT VARIABLES
 133        See environ(5) for descriptions of the following environment variables
 134        that affect the execution of du: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
 135        and NLSPATH.
 136 
 137 EXIT STATUS
 138        The following exit values are returned:
 139 
 140        0
 141              Successful completion.
 142 
 143 
 144        >0
 145              An error occurred.
 146 
 147 
 148 ATTRIBUTES
 149        See attributes(5) for descriptions of the following attributes:
 150 
 151    /usr/bin/du
 152 
 153        +--------------------+-----------------+
 154        |  ATTRIBUTE TYPE    | ATTRIBUTE VALUE |
 155        +--------------------+-----------------+
 156        |CSI                 | Enabled         |
 157        +--------------------+-----------------+
 158        |Interface Stability | Stable          |
 159        +--------------------+-----------------+
 160 
 161    /usr/xpg4/bin/du
 162 
 163        +--------------------+-----------------+
 164        |  ATTRIBUTE TYPE    | ATTRIBUTE VALUE |
 165        +--------------------+-----------------+
 166        |CSI                 | Enabled         |
 167        +--------------------+-----------------+
 168        |Interface Stability | Standard        |
 169        +--------------------+-----------------+
 170 
 171 SEE ALSO
 172        ls(1), stat(2), attributes(5), environ(5), fsattr(5), largefile(5),
 173        standards(5)
 174 
 175 
 176        System Administration Guide: Basic Administration
 177 
 178 NOTES
 179        A file with two or more links is counted only once. If, however, there
 180        are links between files in different directories where the directories
 181        are on separate branches of the file system hierarchy, du will count
 182        the excess files more than once.
 183 



 184 
 185        Files containing holes will result in an incorrect block count.
 186 
 187 
 188 
 189                                February 6, 2007                          DU(1)
   1 DU(1)                            User Commands                           DU(1)
   2 
   3 
   4 
   5 NAME
   6        du - summarize disk usage
   7 
   8 SYNOPSIS
   9        /usr/bin/du [-Adorx] [-a | -s] [-h | -k | -m] [-H | -L]
  10             [file ...]
  11 
  12 
  13        /usr/xpg4/bin/du [-Adorx] [-a | -s] [-h | -k | -m] [-H | -L]
  14             [file ...]
  15 
  16 
  17 DESCRIPTION
  18        The du utility writes to standard output the size of the file space
  19        allocated to, and the size of the file space allocated to each
  20        subdirectory of, the file hierarchy rooted in each of the specified
  21        files. The size of the file space allocated to a file of type directory
  22        is defined as the sum total of space allocated to all files in the file
  23        hierarchy rooted in the directory plus the space allocated to the
  24        directory itself. This sum will include the space allocated to any
  25        extended attributes encountered.
  26 

  27        Files with multiple links will be counted and written for only one
  28        entry. The directory entry that is selected in the report is
  29        unspecified. By default, file sizes are written in 512-byte units,
  30        rounded up to the next 512-byte unit.
  31 
  32    /usr/xpg4/bin/du
  33        When du cannot obtain file attributes or read directories (see
  34        stat(2)), it will report an error condition and the final exit status
  35        will be affected.
  36 
  37 OPTIONS
  38        The following options are supported for /usr/bin/du and
  39        /usr/xpg4/bin/du:
  40 
  41        -a
  42              In addition to the default output, report the size of each file
  43              not of type directory in the file hierarchy rooted in the
  44              specified file. Regardless of the presence of the -a option, non-
  45              directories given as file operands will always be listed.
  46 
  47 
  48        -A
  49              Tally file size using the apparent size of the file instead of
  50              the disk blocks it occupies. This option is useful when operating
  51              on file systems which employ compression or in the presence of
  52              sparse files.
  53 
  54 
  55        -d
  56              Do not cross filesystem boundaries. For example, the command, du
  57              -d / reports usage only on the root partition.
  58 
  59 
  60        -h
  61              All sizes are scaled to a human readable format, for example,
  62              14K, 234M, 2.7G, or 3.0T. Scaling is done by repetitively
  63              dividing by 1024.
  64 
  65 
  66        -H
  67              If a symbolic link to a directory is specified on the command
  68              line, process the symbolic link by using the directory which the
  69              symbolic link references, rather than the link itself.
  70 
  71 
  72        -k
  73              Write the files sizes in units of 1024 bytes, rather than the
  74              default 512-byte units.


 109              the same device as the file specified by the file operand.
 110 
 111 
 112 
 113        Specifying more than one of the options in the mutually exclusive pair,
 114        -H and -L, is not considered an error. The last option specified
 115        determines the output format.
 116 
 117 
 118        Specifying more than one of the options in the mutually exclusive set
 119        of options -h, -k, and -m is not considered an error.  The last option
 120        specified determines the output format.
 121 
 122 OPERANDS
 123        The following operand is supported:
 124 
 125        file
 126                The path name of a file whose size is to be written. If no file
 127                is specified, the current directory is used.
 128 

 129 OUTPUT
 130        The output from du consists of the amount of the space allocated to a
 131        file and the name of the file.
 132 
 133 USAGE
 134        See largefile(5) for the description of the behavior of du when
 135        encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
 136 
 137 ENVIRONMENT VARIABLES
 138        See environ(5) for descriptions of the following environment variables
 139        that affect the execution of du: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES,
 140        and NLSPATH.
 141 
 142 EXIT STATUS
 143        The following exit values are returned:
 144 
 145        0
 146              Successful completion.
 147 

 148        >0
 149              An error occurred.
 150 

 151 ATTRIBUTES
 152        See attributes(5) for descriptions of the following attributes:
 153 
 154    /usr/bin/du
 155 
 156        +--------------------+-----------------+
 157        |  ATTRIBUTE TYPE    | ATTRIBUTE VALUE |
 158        +--------------------+-----------------+
 159        |CSI                 | Enabled         |
 160        +--------------------+-----------------+
 161        |Interface Stability | Stable          |
 162        +--------------------+-----------------+
 163 
 164    /usr/xpg4/bin/du
 165 
 166        +--------------------+-----------------+
 167        |  ATTRIBUTE TYPE    | ATTRIBUTE VALUE |
 168        +--------------------+-----------------+
 169        |CSI                 | Enabled         |
 170        +--------------------+-----------------+
 171        |Interface Stability | Standard        |
 172        +--------------------+-----------------+
 173 
 174 SEE ALSO
 175        ls(1), stat(2), attributes(5), environ(5), fsattr(5), largefile(5),
 176        standards(5)
 177 

 178        System Administration Guide: Basic Administration
 179 
 180 NOTES
 181        A file with two or more links is counted only once. If, however, there
 182        are links between files in different directories where the directories
 183        are on separate branches of the file system hierarchy, du will count
 184        the excess files more than once.
 185 
 186        Files containing holes will result in an incorrect block count. In this
 187        case, one may use the -A option to report file sizes by their apparent
 188        size instead.
 189 

 190 
 191 
 192                                 March 14, 2017                           DU(1)