1 '\" te
   2 .\" Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
   3 .\" Portions Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
   4 .\" Copyright 2017 OmniTI Computer Consulting, Inc. All rights reserved.
   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
   6 .\" http://www.opengroup.org/bookstore/.
   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.
   8 .\"  This notice shall appear on any product containing this material.
   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.
  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.
  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]
  12 .TH DU 1 "March 14, 2017"
  13 .SH NAME
  14 du \- summarize disk usage
  15 .SH SYNOPSIS
  16 .LP
  17 .nf
  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]
  19      [\fIfile\fR ...]
  20 .fi
  21 
  22 .LP
  23 .nf
  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]
  25      [\fIfile\fR ...]
  26 .fi
  27 
  28 .SH DESCRIPTION
  29 .LP
  30 The \fBdu\fR utility writes to standard output the size of the file space
  31 allocated to, and the size of the file space allocated to each subdirectory of,
  32 the file hierarchy rooted in each of the specified files. The size of the file
  33 space allocated to a file of type directory is defined as the sum total of
  34 space allocated to all files in the file hierarchy rooted in the directory plus
  35 the space allocated to the directory itself. This sum will include the space
  36 allocated to any extended attributes encountered.
  37 .LP
  38 Files with multiple links will be counted and written for only one entry. The
  39 directory entry that is selected in the report is unspecified. By default, file
  40 sizes are written in 512-byte units, rounded up to the next 512-byte unit.
  41 .SS "/usr/xpg4/bin/du"
  42 .LP
  43 When \fBdu\fR cannot obtain file attributes or read directories (see
  44 \fBstat\fR(2)), it will report an error condition and the final exit status
  45 will be affected.
  46 .SH OPTIONS
  47 .LP
  48 The following options are supported for \fB/usr/bin/du\fR and
  49 \fB/usr/xpg4/bin/du\fR:
  50 .sp
  51 .ne 2
  52 .na
  53 \fB\fB-a\fR\fR
  54 .ad
  55 .RS 6n
  56 In addition to the default output, report the size of each file not of type
  57 directory in the file hierarchy rooted in the specified file. Regardless of the
  58 presence of the \fB-a\fR option, non-directories given as \fIfile\fR operands
  59 will always be listed.
  60 .RE
  61 
  62 .sp
  63 .ne 2
  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
  76 \fB\fB-d\fR\fR
  77 .ad
  78 .RS 6n
  79 Do not cross filesystem boundaries. For example, the command, \fBdu -d /\fR
  80 reports usage only on the root partition.
  81 .RE
  82 
  83 .sp
  84 .ne 2
  85 .na
  86 \fB\fB-h\fR\fR
  87 .ad
  88 .RS 6n
  89 All sizes are scaled to a human readable format, for example, \fB14K\fR,
  90 \fB234M\fR, \fB2.7G\fR, or \fB3.0T\fR. Scaling is done by repetitively dividing
  91 by \fB1024\fR.
  92 .RE
  93 
  94 .sp
  95 .ne 2
  96 .na
  97 \fB\fB-H\fR\fR
  98 .ad
  99 .RS 6n
 100 If a symbolic link to a directory is specified on the command line, process the
 101 symbolic link by using the directory which the symbolic link references, rather
 102 than the link itself.
 103 .RE
 104 
 105 .sp
 106 .ne 2
 107 .na
 108 \fB\fB-k\fR\fR
 109 .ad
 110 .RS 6n
 111 Write the files sizes in units of 1024 bytes, rather than the default 512-byte
 112 units.
 113 .RE
 114 
 115 .sp
 116 .ne 2
 117 .na
 118 \fB\fB-L\fR\fR
 119 .ad
 120 .RS 6n
 121 Process symbolic links by using the file or directory which the symbolic link
 122 references, rather than the link itself.
 123 .RE
 124 
 125 .sp
 126 .ne 2
 127 .na
 128 \fB\fB-m\fR\fR
 129 .ad
 130 .RS 6n
 131 Write the files sizes in units of megabytes, rather than the default 512-byte
 132 units.
 133 .RE
 134 
 135 .sp
 136 .ne 2
 137 .na
 138 \fB\fB-o\fR\fR
 139 .ad
 140 .RS 6n
 141 Do not add child directories' usage to a parent's total. Without this option,
 142 the usage listed for a particular directory is the space taken by the files in
 143 that directory, as well as the files in all directories beneath it. This option
 144 does nothing if \fB-s\fR is used.
 145 .RE
 146 
 147 .sp
 148 .ne 2
 149 .na
 150 \fB\fB-r\fR\fR
 151 .ad
 152 .RS 6n
 153 Generate diagnostic messages about unreadable directories and files whose
 154 status cannot be obtained. /usr/bin/du is silent if these conditions arise and
 155 \fB-r\fR is not specified. \fB/usr/xpg4/bin/du\fR acts as though \fB-r\fR is
 156 always specified.
 157 .RE
 158 
 159 .sp
 160 .ne 2
 161 .na
 162 \fB\fB-s\fR\fR
 163 .ad
 164 .RS 6n
 165 Instead of the default output, report only the total sum for each of the
 166 specified files.
 167 .RE
 168 
 169 .sp
 170 .ne 2
 171 .na
 172 \fB\fB-x\fR\fR
 173 .ad
 174 .RS 6n
 175 When evaluating file sizes, evaluate only those files that have the same device
 176 as the file specified by the file operand.
 177 .RE
 178 
 179 .sp
 180 .LP
 181 Specifying more than one of the options in the mutually exclusive pair,
 182 \fB-H\fR and \fB-L\fR, is not considered an error. The last option specified
 183 determines the output format.
 184 .sp
 185 .LP
 186 Specifying more than one of the options in the mutually exclusive set of
 187 options \fB-h\fR, \fB-k\fR, and \fB-m\fR is not considered an error.  The last
 188 option specified determines the output format.
 189 .SH OPERANDS
 190 .LP
 191 The following operand is supported:
 192 .sp
 193 .ne 2
 194 .na
 195 \fB\fIfile\fR\fR
 196 .ad
 197 .RS 8n
 198 The path name of a file whose size is to be written. If no \fIfile\fR is
 199 specified, the current directory is used.
 200 .RE
 201 .SH OUTPUT
 202 .LP
 203 The output from \fBdu\fR consists of the amount of the space allocated to a
 204 file and the name of the file.
 205 .SH USAGE
 206 .LP
 207 See \fBlargefile\fR(5) for the description of the behavior of \fBdu\fR when
 208 encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
 209 .SH ENVIRONMENT VARIABLES
 210 .LP
 211 See \fBenviron\fR(5) for descriptions of the following environment variables
 212 that affect the execution of \fBdu\fR: \fBLANG\fR, \fBLC_ALL\fR,
 213 \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR, and \fBNLSPATH\fR.
 214 .SH EXIT STATUS
 215 .LP
 216 The following exit values are returned:
 217 .sp
 218 .ne 2
 219 .na
 220 \fB\fB0\fR\fR
 221 .ad
 222 .RS 6n
 223 Successful completion.
 224 .RE
 225 .sp
 226 .ne 2
 227 .na
 228 \fB\fB>0\fR\fI\fR\fR
 229 .ad
 230 .RS 6n
 231 An error occurred.
 232 .RE
 233 .SH ATTRIBUTES
 234 .LP
 235 See \fBattributes\fR(5) for descriptions of the following attributes:
 236 .SS "/usr/bin/du"
 237 
 238 .TS
 239 box;
 240 c | c
 241 l | l .
 242 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 243 _
 244 CSI     Enabled
 245 _
 246 Interface Stability     Stable
 247 .TE
 248 
 249 .SS "/usr/xpg4/bin/du"
 250 
 251 .TS
 252 box;
 253 c | c
 254 l | l .
 255 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 256 _
 257 CSI     Enabled
 258 _
 259 Interface Stability     Standard
 260 .TE
 261 
 262 .SH SEE ALSO
 263 .LP
 264 \fBls\fR(1), \fBstat\fR(2), \fBattributes\fR(5), \fBenviron\fR(5),
 265 \fBfsattr\fR(5), \fBlargefile\fR(5), \fBstandards\fR(5)
 266 .LP
 267 \fISystem Administration Guide: Basic Administration\fR
 268 .SH NOTES
 269 .LP
 270 A file with two or more links is counted only once. If, however, there are
 271 links between files in different directories where the directories are on
 272 separate branches of the file system hierarchy, \fBdu\fR will count the excess
 273 files more than once.
 274 .LP
 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.