Share on Facebook Share on Twitter Email
Answers.com

Du

 
Wikipedia: Du (Unix)
example screenshot of du in a terminal

du (abbreviated from disk usage) is a standard Unix program used to estimate the file space usage; space used under a particular directory or files on a file system.

Contents

History

The du utility first appeared in version 1 of AT&T UNIX.

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.

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 1024 bytes, 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 appropriate SI prefix (eg. 10 MB). GNU du however conflicts with the SUS specification by using the short -H option to display binary prefixes instead.

Examples

Sum of directories in kilobytes:

$ du -sk *
152304  directoryOne
1856548 directoryTwo

Sum of directories in human-readable format (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 .[A-z]* *|sort -n

The weight of directories:

$ du -d 1 -c -h

See also

External links

  • du — specification from the Single Unix Specification

Manual pages

Other


Search unanswered questions...
Enter a question here...
Search: All sources Community Q&A Reference topics
Shopping: Du
Top
 
 
Learn More
Du. (abbreviation)
du jour
soup du jour

What is du in Unix? Read answer...
What does Du mean? Read answer...
How do these gases cause global warming. du du du. postman pat did yermam? Read answer...

Help us answer these
What is the definition of Du?
Who was Du Guesclin?
What does Du Has mean?

Post a question - any question - to the WikiAnswers community:

 

Copyrights:

Wikipedia. This article is licensed under the Creative Commons Attribution/Share-Alike License. It uses material from the Wikipedia article "Du (Unix)" Read more