HOME

TheInfoList



OR:

du (abbreviated from ''disk usage'') is a standard
Unix Unix (; trademarked as UNIX) is a family of multitasking, multiuser computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
program used to estimate file space usage—space used under a particular
directory Directory may refer to: * Directory (computing), or folder, a file system structure in which to store computer files * Directory (OpenVMS command) * Directory service, a software application for organizing information about a computer network' ...
or
files File or filing may refer to: Mechanical tools and processes * File (tool), a tool used to ''remove'' fine amounts of material from a workpiece **Filing (metalworking), a material removal process in manufacturing ** Nail file, a tool used to gent ...
on a
file system In computing, file system or filesystem (often abbreviated to fs) is a method and data structure that the operating system uses to control how data is stored and retrieved. Without a file system, data placed in a storage medium would be one lar ...
. A
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for ...
commandline version of this program is part of Sysinternals suite by
Mark Russinovich Mark Eugene Russinovich (born December 22, 1966) is a Spanish-born American software engineer and author who serves as CTO of Microsoft Azure. He was a cofounder of software producers Winternals before it was acquired by Microsoft in 2006. Ear ...
.


History

The du utility first appeared in version 1 of AT&T UNIX. The version of du bundled in
GNU GNU () is an extensive collection of free software Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any ...
coreutils The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems. In September 2002, the ''GNU coreutils'' were c ...
was written by Torbjorn Granlund, David MacKenzie, Paul Eggert, and Jim Meyering. The command is also available for
FreeDOS FreeDOS (formerly Free-DOS and PD-DOS) is a free software operating system for IBM PC compatible computers. It intends to provide a complete MS-DOS-compatible environment for running legacy software and supporting embedded systems. FreeDOS ca ...
.


Specification

By default, the Single UNIX Specification (SUS) specifies that du 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 by du may vary from that shown by df if files have been deleted but their blocks not yet freed. Also the minfree setting that allocates datablocks for the filesystem and the super user processes creates a discrepancy between total blocks and the sum of used and available blocks. The minfree setting is usually set to about 5% of the total filesystem size. For more info se
core utils faq


Usage

du takes a single argument, specifying a pathname for to work; if it is not specified, the current directory is used. The SUS mandates for the following options: * , In addition to the default output, include information for each non-directory entry * , display a grand total of the disk usage found by the other arguments * , the depth at which summing should occur. -d 0 sums at the current level, -d 1 sums at the subdirectory, -d 2 at sub-subdirectories, etc. * , calculate disk usage for link references specified on the command line * , show sizes as multiples of 1024
byte The byte is a unit of digital information that most commonly consists of eight bits. Historically, the byte was the number of bits used to encode a single character of text in a computer and for this reason it is the smallest addressable unit ...
s, not 512-byte * , calculate disk usage for link references anywhere * , report only the sum of the usage in the current directory, not for each directory therein contained * , only traverse files and directories on the device on which the pathname argument is specified. Other Unix and Unix-like operating systems may add extra options. For example, BSD and GNU du specify a option, displaying disk usage in a format easier to read by the user, adding units with the appropriate
SI prefix The International System of Units, known by the international abbreviation SI in all languages and sometimes pleonastically as the SI system, is the modern form of the metric system and the world's most widely used system of measurement. ...
(e.g. 10 MB).


Examples

Sum of directories (-s) in
kilobyte The kilobyte is a multiple of the unit byte for digital information. The International System of Units (SI) defines the prefix '' kilo'' as 1000 (103); per this definition, one kilobyte is 1000 bytes.International Standard IEC 80000-13 Quanti ...
s (-k): $ du -sk * 152304 directoryOne 1856548 directoryTwo Sum of directories (-s) in
human-readable A human-readable medium or human-readable format is any encoding of data or information that can be naturally read by humans. In computing, ''human-readable'' data is often encoded as ASCII or Unicode text, rather than as binary data. In most ...
format (-h : Byte, Kilobyte, Megabyte, Gigabyte, Terabyte and Petabyte): $ du -sh * 149M directoryOne 1.8G directoryTwo disk usage of all subdirectories and files including hidden files within the current directory (sorted by filesize) : $ du -sk . . *, sort -n disk usage of all subdirectories and files including hidden files within the current directory (sorted by reverse filesize) : $ du -sk . . *, sort -nr The weight (size) of each subdirectory under the current directory (-d 1) with a sum total at the end (-c) all displayed in human-readable format (-h): $ du -d 1 -c -h or with du from GNU: $ du --max-depth=1 -c -h The weight (size) of subdirectories under the root directory (-d 1, trailing /) with a sum total at the end (-c), all displayed in human-readable format (-h) without traversing into other filesystems (-x). Useful when /var /tmp or other directories are on separate storage from the root directory: $ du -d 1 -c -h -x / or with du from GNU: $ du --max-depth=1 -c -h -x /


See also

*
List of Unix commands This is a list of Unix commands as specified by IEEE Std 1003.1-2008, which is part of the Single UNIX Specification (SUS). These commands can be found on Unix operating systems and most Unix-like operating systems. List See also * List of G ...
* Filelight * Disk Usage Analyzer * ncdu


References


External links

* * {{Core Utilities commands Standard Unix programs Unix SUS2008 utilities Plan 9 commands Inferno (operating system) commands Disk usage analysis software Unix file system-related software