du (Unix)
| du | |
|---|---|
Example screenshot of du in a terminal | |
| Original authors | Dennis Ritchie (AT&T Bell Laboratories) |
| Developers | Various open-source and commercial developers |
| Initial release | 3 November 1971 |
| Written in | Plan 9, FreeDOS: C |
| Operating system | Unix, Unix-like, Plan 9, Inferno, FreeDOS |
| Platform | Cross-platform |
| Type | Command |
| License | coreutils: GPLv3+ Plan 9: MIT License FreeDOS: GPLv2 |
du is a shell command for reporting the file system storage allocated to files and directory trees. With no command-line arguments, it reports the space allocated to the working directory and to each directory tree that it contains, recursively. Space allocated to files is reported if files are specified for inclusion. For a symbolic link file, the size of the link file is reported, not what it links to.
Although du is short for disk usage, the command is not limited to disk storage. It was developed during the long period of time when disk-based storage was the ubiquitous mass storage technology.
du differs from df in that du reports size information of file system items whereas df reports statistics about the storage media as a whole. du can report more detailed information, but can take longer to complete when processing many files. Also, since a storage media may have allocated space that is not associated with an accessible file (i.e. file was deleted but space not freed), df might report more allocated space than du if it were used to calculate the space of all files of a media. Also, the minfree setting that allocates data blocks for the file system and the super user processes creates a discrepancy between total blocks and the sum of used and available blocks.
The du command first appeared in version 1 of AT&T UNIX. It is specified by the Single UNIX Specification (SUS). The implementation in GNU coreutils was written by Torbjorn Granlund, David MacKenzie, Paul Eggert, and Jim Meyering. The command is also available for FreeDOS. A similar command is available for Windows in Sysinternals by Mark Russinovich.