The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

du - estimate file space usage

 SYNOPSIS



du [-a| -s][-kx][-r][file ...]

 DESCRIPTION

By default, 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.

When du cannot stat() files or stat() or read directories, it will report an error condition and the final exit status will be affected. 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.

 OPTIONS

The du utility supports the XBD specification, Utility Syntax Guidelines  .

The following options are supported:

-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.
-k
Write the files sizes in units of 1024 bytes, rather than the default 512-byte units.
-r
Generate messages about directories that cannot be read, files that cannot be opened, and so on. This is the default case.
-s
Instead of the default output, report only the total sum for each of the specified files.
-x
When evaluating file sizes, evaluate only those files that have the same device as the file specified by the file operand.

 OPERANDS

The following operand is supported:
file
The pathname of a file whose size is to be written. If no file is specified, the current directory is used.

 STDIN

Not used.

 INPUT FILES

None.

 ENVIRONMENT VARIABLES

The following environment variables affect the execution of du:
LANG
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
LC_ALL
If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
NLSPATH
Determine the location of message catalogues for the processing of LC_MESSAGES .

 ASYNCHRONOUS EVENTS

Default.

 STDOUT

The output from du consists of the amount of the space allocated to a file and the name of the file, in the following format:

"%d %s\n", <size>, <pathname>

 STDERR

Used only for diagnostic messages.

 OUTPUT FILES

None.

 EXTENDED DESCRIPTION

None.

 EXIT STATUS

The following exit values are returned:
0
Successful completion.
>0
An error occurred.

 CONSEQUENCES OF ERRORS

Default.

 APPLICATION USAGE

None.

 EXAMPLES

None.

 FUTURE DIRECTIONS

None.

 SEE ALSO

ls.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]