Copyright (c) 1992, X/Open Company Limited. All Rights Reserved.
Portions Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
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
http://www.opengroup.org/bookstore/.
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.
This notice shall appear on any product containing this material.
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.
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.
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]
/usr/bin/du [-dorx] [-a | -s] [-h | -k | -m] [-H | -L] [file ...]
/usr/xpg4/bin/du [-dorx] [-a | -s] [-h | -k | -m] [-H | -L] [file ...]
The du utility writes to standard output the size of the file space allocated to, and the size of the file space allocated to each subdirectory of, the file hierarchy rooted in each of the specified files. The size of the file space allocated to a file of type directory is defined as the sum total of space allocated to all files in the file hierarchy rooted in the directory plus the space allocated to the directory itself. This sum will include the space allocated to any extended attributes encountered.
Files with multiple links will be counted and written for only one entry. The directory entry that is selected in the report is unspecified. By default, file sizes are written in 512-byte units, rounded up to the next 512-byte unit.
When du cannot obtain file attributes or read directories (see stat(2)), it will report an error condition and the final exit status will be affected.
The following options are supported for /usr/bin/du and /usr/xpg4/bin/du: -a
In addition to the default output, report the size of each file not of type directory in the file hierarchy rooted in the specified file. Regardless of the presence of the -a option, non-directories given as file operands will always be listed.
Do not cross filesystem boundaries. For example, the command, du -d / reports usage only on the root partition.
All sizes are scaled to a human readable format, for example, 14K, 234M, 2.7G, or 3.0T. Scaling is done by repetitively dividing by 1024.
If a symbolic link to a directory is specified on the command line, process the symbolic link by using the directory which the symbolic link references, rather than the link itself.
Write the files sizes in units of 1024 bytes, rather than the default 512-byte units.
Process symbolic links by using the file or directory which the symbolic link references, rather than the link itself.
Write the files sizes in units of megabytes, rather than the default 512-byte units.
Do not add child directories' usage to a parent's total. Without this option, the usage listed for a particular directory is the space taken by the files in that directory, as well as the files in all directories beneath it. This option does nothing if -s is used.
Generate diagnostic messages about unreadable directories and files whose status cannot be obtained. /usr/bin/du is silent if these conditions arise and -r is not specified. /usr/xpg4/bin/du acts as though -r is always specified.
Instead of the default output, report only the total sum for each of the specified files.
When evaluating file sizes, evaluate only those files that have the same device as the file specified by the file operand.
Specifying more than one of the options in the mutually exclusive pair, -H and -L, is not considered an error. The last option specified determines the output format.
Specifying more than one of the options in the mutually exclusive set of options -h, -k, and -m is not considered an error. The last option specified determines the output format.
The following operand is supported: file
The path name of a file whose size is to be written. If no file is specified, the current directory is used.
The output from du consists of the amount of the space allocated to a file and the name of the file.
See largefile(5) for the description of the behavior of du when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes).
See environ(5) for descriptions of the following environment variables that affect the execution of du: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH.
The following exit values are returned: 0
Successful completion.
An error occurred.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE ATTRIBUTE VALUE |
CSI Enabled |
Interface Stability Stable |
ATTRIBUTE TYPE ATTRIBUTE VALUE |
CSI Enabled |
Interface Stability Standard |
ls(1), stat(2), attributes(5), environ(5), fsattr(5), largefile(5), standards(5)
System Administration Guide: Basic Administration
A file with two or more links is counted only once. If, however, there are links between files in different directories where the directories are on separate branches of the file system hierarchy, du will count the excess files more than once.
Files containing holes will result in an incorrect block count.