- Du (Unix)
du
(abbreviated from "disk usage") is a standardUnix program used to estimate the file space usage; space used under a particular directory or files on afile system .History
The
du
utility first appeared in version 1 ofAT&T UNIX .Specification
By default, the
Single Unix Specification (SUS) specifies thatdu
is to display the file space allocated to each file and directory contained in the current directory. Links will be displayed as the size of the link file, not what is being linked to; the size of the content of directories is displayed, as expected.As
du
reports allocation space and not absolute file space, the amount of space on a file system shown bydu
may vary from that shown bydf
if files have been deleted but their blocks not yet freed.Usage
du
takes a single argument, specifying a pathname for du to work; if it is not specified, the current directory is used. The SUS mandates for du the following options:: -a, display an entry for each file (and not directory) contained in the current directory: -H, calculate disk usage for link references specified on the command line: -k, show sizes as multiples of 1024byte s, not 512-byte : -L, calculate disk usage for link references anywhere: -s, report only the sum of the usage in the current directory, not for each file: -x, only traverse files and directories on the device on which the pathname argument is specified.: -h, show filesize in human readable format.Other Unix and Unix-like operating systems may add extra options. For example, BSD and GNU
du
specify a -h option, displaying disk usage in a format easier to read by the user, adding units with the appropriateSI prefix (eg. 10 MB). GNUdu
however conflicts with the SUS specification by using the short -H option to displaybinary prefix es instead.Examples
Sum of directories in
kilobyte s: $ du -sk * 2800344 directoryOne 4270554 directoryTwo$ du -skh * 2.8M directoryOne 4.2M directoryTwodisk usage of all subdirectories and files including hidden files within the current directory (sorted by filesize) : $ du -sk . [A-z] * *|sort -n
The weight of directories: $ du -d 1 -c -h
ee also
*
List of Unix programs
*Filelight
*BaobabExternal links
* [http://www.opengroup.org/onlinepubs/009695399/utilities/du.html du] — specification from the Single Unix Specification
Manual pages
* [http://www.gnu.org/software/coreutils/manual/html_node/du-invocation.html du] — manual page from
GNU coreutils
* [http://www.openbsd.org/cgi-bin/man.cgi?query=du du] — manual page fromOpenBSD
* [http://leaf.dragonflybsd.org/cgi/web-man?command=du§ion=ANY du] — manual page fromDragonflybsd Other
* [http://www.bellevuelinux.org/du.html The du Command] by The Linux Information Project (LINFO)
* [http://freshmeat.net/search/?q=disk+space Disk space-related utilities] at Freshmeat.net
Wikimedia Foundation. 2010.