du - display disk usage statistics


du [-H | -L | -P] [-a | -s] [-cklrx] [file ...]


The du utility displays the file system block usage for each file argument and for each directory in the file hierarchy rooted in each directory argument. If no file is specified, the block usage of the hierarchy rooted in the current directory is displayed.

The options are as follows:

-H Symbolic links on the command line are followed. (Symbolic links encountered in the tree traversal are not followed.)

-L All symbolic links are followed.

-P No symbolic links are followed.

-a Display an entry for each file in the file hierarchy.

-k By default, du displays the number of blocks as the number of 512-byte blocks. If the -k flag is specified, the number displayed is the number of 1024-byte blocks. Partial numbers of blocks are rounded up.

-c Display the grand total after all the arguments have been processed.

-l Count the size of all files, even if they have appeared already in another hard link.

-s Display only the grand total for the specified files.

-r Generate messages about directories that cannot be read, files that cannot be opened, and so on. This is the default case. This option exists solely for conformance with X/Open Portability Guide Issue 4 (``XPG4'').

-x Filesystem mount points are not traversed.

du counts the storage used by symbolic links and not the files they reference unless the -H or -L option is specified. If either the -H or -L options are specified, storage used by any symbolic links which are followed is not counted or displayed.

Files having multiple hard links are counted (and displayed) a single time per du execution.


If the environment variable BLOCKSIZE is set, and the -k option is not specified, the block counts will be displayed in units of that size block.


The directory separator is assumed to be '/'.

The number of blocks reported is based on the size of the file. This may or may not reflect the actual number of blocks allocated by the file system for the file.

du will skip files it shouldn't if the underlying file system does not support inodes, and does not always place 0 in the inode field of a stat(2) call. In this case -l can be specified to skip the inode check and always list all files.


A du command appeared in Version 6 AT&T UNIX.


Greg Hewgill <> 1999-03-07


This program is Copyright (c) by Greg Hewgill 1999.

This program is free and open software. You may use, copy, modify, distribute, and sell this program (and any modified variants) in any way you wish, provided you do not restrict others from doing the same.