du - Summarize usage of file space
du [-a|-s[-krtx] [ pathname ...]
du reports the amount of file space that is used by the files indicated by the given path name. If the path name is a directory, du reports the total amount of file space that is used by all files in that directory and in each subdirectory in its hierarchy. If you do not specify a path name, du assumes the current directory. Files with multiple links are only counted once. On systems supporting symbolic links, only the disk space that is used by the symbolic link is counted.
du measures file space in 512-byte units.
- Generates a report for all files in pathname.
- Displays file sizes in 1024-byte (1 KB) units.
- Reports files that cannot be opened and directories that cannot be read; this is the default.
- Does not display file size totals for subdirectories.
- Displays the total amount of space used by all path names examined.
- Displays file sizes for only those files that are contained on the same device as pathname.
du computes file space in units of 512 bytes. The actual disk space that is used by files and directories might be more, since some systems allocate space in units of some multiple of a sector. On UNIX System V, it is usually two sectors; on UNIX Version 7, it is one sector.
The allocation unit is file system specific.
- Successful completion
- Failure due to any of the following reasons:
- Incorrect command-line option.
- Cannot access a directory.
- Cannot read a directory.
- Cannot access file information.
POSIX.2 User Portability Extension, X/Open Portability Guide, UNIX systems.
The -t option is an extension to the POSIX standard.
df, find, ls