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>

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man1/du.1
          +++ new/usr/src/man/man1/du.1
   1    1  '\" te
   2    2  .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
   3    3  .\" Portions Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
        4 +.\" Copyright 2017 OmniTI Computer Consulting, Inc. All rights reserved.
   4    5  .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
   5    6  .\" http://www.opengroup.org/bookstore/.
   6    7  .\" The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
   7    8  .\"  This notice shall appear on any product containing this material.
   8    9  .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
   9   10  .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
  10   11  .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
  11      -.TH DU 1 "Feb 6, 2007"
       12 +.TH DU 1 "March 14, 2017"
  12   13  .SH NAME
  13   14  du \- summarize disk usage
  14   15  .SH SYNOPSIS
  15   16  .LP
  16   17  .nf
  17      -\fB/usr/bin/du\fR [\fB-dorx\fR] [\fB-a\fR | \fB-s\fR] [\fB-h\fR | \fB-k\fR | \fB-m\fR] [\fB-H\fR | \fB-L\fR]
       18 +\fB/usr/bin/du\fR [\fB-Adorx\fR] [\fB-a\fR | \fB-s\fR] [\fB-h\fR | \fB-k\fR | \fB-m\fR] [\fB-H\fR | \fB-L\fR]
  18   19       [\fIfile\fR ...]
  19   20  .fi
  20   21  
  21   22  .LP
  22   23  .nf
  23      -\fB/usr/xpg4/bin/du\fR [\fB-dorx\fR] [\fB-a\fR | \fB-s\fR] [\fB-h\fR | \fB-k\fR | \fB-m\fR] [\fB-H\fR | \fB-L\fR]
       24 +\fB/usr/xpg4/bin/du\fR [\fB-Adorx\fR] [\fB-a\fR | \fB-s\fR] [\fB-h\fR | \fB-k\fR | \fB-m\fR] [\fB-H\fR | \fB-L\fR]
  24   25       [\fIfile\fR ...]
  25   26  .fi
  26   27  
  27   28  .SH DESCRIPTION
  28      -.sp
  29   29  .LP
  30   30  The \fBdu\fR utility writes to standard output the size of the file space
  31   31  allocated to, and the size of the file space allocated to each subdirectory of,
  32   32  the file hierarchy rooted in each of the specified files. The size of the file
  33   33  space allocated to a file of type directory is defined as the sum total of
  34   34  space allocated to all files in the file hierarchy rooted in the directory plus
  35   35  the space allocated to the directory itself. This sum will include the space
  36   36  allocated to any extended attributes encountered.
  37      -.sp
  38   37  .LP
  39   38  Files with multiple links will be counted and written for only one entry. The
  40   39  directory entry that is selected in the report is unspecified. By default, file
  41   40  sizes are written in 512-byte units, rounded up to the next 512-byte unit.
  42   41  .SS "/usr/xpg4/bin/du"
  43      -.sp
  44   42  .LP
  45   43  When \fBdu\fR cannot obtain file attributes or read directories (see
  46   44  \fBstat\fR(2)), it will report an error condition and the final exit status
  47   45  will be affected.
  48   46  .SH OPTIONS
  49      -.sp
  50   47  .LP
  51   48  The following options are supported for \fB/usr/bin/du\fR and
  52   49  \fB/usr/xpg4/bin/du\fR:
  53   50  .sp
  54   51  .ne 2
  55   52  .na
  56   53  \fB\fB-a\fR\fR
  57   54  .ad
  58   55  .RS 6n
  59   56  In addition to the default output, report the size of each file not of type
  60   57  directory in the file hierarchy rooted in the specified file. Regardless of the
  61   58  presence of the \fB-a\fR option, non-directories given as \fIfile\fR operands
  62   59  will always be listed.
  63   60  .RE
  64   61  
  65   62  .sp
  66   63  .ne 2
  67   64  .na
       65 +\fB\fB-A\fR\fR
       66 +.ad
       67 +.RS 6n
       68 +Tally file size using the apparent size of the file instead of the disk blocks
       69 +it occupies. This option is useful when operating on file systems which employ
       70 +compression or in the presence of sparse files.
       71 +.RE
       72 +
       73 +.sp
       74 +.ne 2
       75 +.na
  68   76  \fB\fB-d\fR\fR
  69   77  .ad
  70   78  .RS 6n
  71   79  Do not cross filesystem boundaries. For example, the command, \fBdu -d /\fR
  72   80  reports usage only on the root partition.
  73   81  .RE
  74   82  
  75   83  .sp
  76   84  .ne 2
  77   85  .na
↓ open down ↓ 94 lines elided ↑ open up ↑
 172  180  .LP
 173  181  Specifying more than one of the options in the mutually exclusive pair,
 174  182  \fB-H\fR and \fB-L\fR, is not considered an error. The last option specified
 175  183  determines the output format.
 176  184  .sp
 177  185  .LP
 178  186  Specifying more than one of the options in the mutually exclusive set of
 179  187  options \fB-h\fR, \fB-k\fR, and \fB-m\fR is not considered an error.  The last
 180  188  option specified determines the output format.
 181  189  .SH OPERANDS
 182      -.sp
 183  190  .LP
 184  191  The following operand is supported:
 185  192  .sp
 186  193  .ne 2
 187  194  .na
 188  195  \fB\fIfile\fR\fR
 189  196  .ad
 190  197  .RS 8n
 191  198  The path name of a file whose size is to be written. If no \fIfile\fR is
 192  199  specified, the current directory is used.
 193  200  .RE
 194      -
 195  201  .SH OUTPUT
 196      -.sp
 197  202  .LP
 198  203  The output from \fBdu\fR consists of the amount of the space allocated to a
 199  204  file and the name of the file.
 200  205  .SH USAGE
 201      -.sp
 202  206  .LP
 203  207  See \fBlargefile\fR(5) for the description of the behavior of \fBdu\fR when
 204  208  encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
 205  209  .SH ENVIRONMENT VARIABLES
 206      -.sp
 207  210  .LP
 208  211  See \fBenviron\fR(5) for descriptions of the following environment variables
 209  212  that affect the execution of \fBdu\fR: \fBLANG\fR, \fBLC_ALL\fR,
 210  213  \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
 211  214  .SH EXIT STATUS
 212      -.sp
 213  215  .LP
 214  216  The following exit values are returned:
 215  217  .sp
 216  218  .ne 2
 217  219  .na
 218  220  \fB\fB0\fR\fR
 219  221  .ad
 220  222  .RS 6n
 221  223  Successful completion.
 222  224  .RE
 223      -
 224  225  .sp
 225  226  .ne 2
 226  227  .na
 227  228  \fB\fB>0\fR\fI\fR\fR
 228  229  .ad
 229  230  .RS 6n
 230  231  An error occurred.
 231  232  .RE
 232      -
 233  233  .SH ATTRIBUTES
 234      -.sp
 235  234  .LP
 236  235  See \fBattributes\fR(5) for descriptions of the following attributes:
 237  236  .SS "/usr/bin/du"
 238      -.sp
 239  237  
 240      -.sp
 241  238  .TS
 242  239  box;
 243  240  c | c
 244  241  l | l .
 245  242  ATTRIBUTE TYPE  ATTRIBUTE VALUE
 246  243  _
 247  244  CSI     Enabled
 248  245  _
 249  246  Interface Stability     Stable
 250  247  .TE
 251  248  
 252  249  .SS "/usr/xpg4/bin/du"
 253      -.sp
 254  250  
 255      -.sp
 256  251  .TS
 257  252  box;
 258  253  c | c
 259  254  l | l .
 260  255  ATTRIBUTE TYPE  ATTRIBUTE VALUE
 261  256  _
 262  257  CSI     Enabled
 263  258  _
 264  259  Interface Stability     Standard
 265  260  .TE
 266  261  
 267  262  .SH SEE ALSO
 268      -.sp
 269  263  .LP
 270  264  \fBls\fR(1), \fBstat\fR(2), \fBattributes\fR(5), \fBenviron\fR(5),
 271  265  \fBfsattr\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)
 272      -.sp
 273  266  .LP
 274  267  \fISystem Administration Guide: Basic Administration\fR
 275  268  .SH NOTES
 276      -.sp
 277  269  .LP
 278  270  A file with two or more links is counted only once. If, however, there are
 279  271  links between files in different directories where the directories are on
 280  272  separate branches of the file system hierarchy, \fBdu\fR will count the excess
 281  273  files more than once.
 282      -.sp
 283  274  .LP
 284      -Files containing holes will result in an incorrect block count.
      275 +Files containing holes will result in an incorrect block count. In this case,
      276 +one may use the \fB-A\fR option to report file sizes by their apparent size
      277 +instead.
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX