du (Disk Usage) Command in Linux

In short, "du"(Disk Usage) is command Linux / Unix we can check the volume occupied (information use) hard disk de folders si files.
An order very useful especially when we are limited by Hard disk space - or SSD - And we want to find out quickly that files and / or folders the "voluminous". Of course, command "du" It can be used in a variety of syntaxes that we use the information desired return.

Command line syntax"Du" is very simple and very flexible, as are all linux commands.

In order documentation "du", we are given the following options:

[Root @ server] # du -help
Usage: du [OPTION] ... [FILE] ...
or: go [OPTION] ... -files0-from = F
Summarize disk usage of each FILE, recursively for directories.

Mandatory arguments to long options is mandatory for short options too.
-a, -all write counts for all files, not just directories
-apparent-size print apparent sizes, rather than disk usage; although the apparent size is usually Smaller, it May be larger due to holes in ( `sparse ') files, internal fragmentation, indirect blocks, and the like
-B, -block-Size = SIZE use SIZE-byte blocks
-b, -bytes equivalent to `-apparent-size -block-size = 1 '
-c, -total produce a grand total
-D, -dereference-Args dereference only symlinks That is Listed on the command line
-files0-from = F summarize disk usage of the NUL-terminated file names Specified in file F;
If F is - the then read names from standard input
-H Equivalent to -dereference-args (-D)
-h, -human-readable print sizes in human readable format (eg, 1K 234M 2G)
-and like -h, but use Powers of 1000 1024 not
-block-size = -k like 1K
, -count-links count sizes many times if hard linked
-m like -block-size = 1M
-L, -dereference Dereference all symbolic links
-P, -no-Dereference do not follow any symbolic links (this is the default)
-0, -null End each output line with 0 byte rather than newline
-S, -separate-Dirs do not include size of subdirectories
-s, -summarize display only a total for each argument
-x, -one-file-system skip directories on different file systems
-X, -exclude-From = FILE exclude files that match any pattern in FILE
-exclude = PATTERN exclude files that match PATTERN
-max-depth = N print the total for a directory (or file, with -all) only if it is N or fewer levels Below the command line argument; -max-depth = 0 is the same as
-time show time of the last modification of any file in the directory, or any of ITS subdirectories
-time = WORD show time as WORD INSTEAD OF modification time: atime, access, use, ctime or status
-time-style = STYLE show times Using style STYLE: full-iso, long-iso, iso, + FORMAT
FORMAT is interpreted like `date '
-help display this help and exit
-version output version information and exit

Display values ​​has units of the first available SIZE from -block-size, and the DU_BLOCK_SIZE, BLOCK_SIZE blocksize and environment variables.
Otherwise, default units to 1024 bytes (or if POSIXLY_CORRECT 512 is set).

SIZE type requested (or integer type requested Optionally year FOLLOWED by) one of GMT: KB 1000, 1024 K, MB 1000 1000 *, M * 1024 1024, and so on for G, T, P, E, Z, Y.

All the above options can be combined in command lines that we display accurate reports about the files and folders concerned. For example, if you want to see the volume of individual folders and files from a specific location (/ var, in our example), the command line will f

[Root @ server var] # -and du -s * | sort -h

This means Individual volume display busy folders and files in / var, sorted descending.

sort -h"- Sorts and displays the result in"Human Readable Format".Bytes, kilobytes, megabytes, gigabytes.

-and"- It has somewhat the same function as" -h "but instead uses 1000 1024.

-s"- Displays the total for the parent directory, without specifying the folders and files under it.


du (Disk Usage) Command in Linux

About the author


Passionate about everything that means gadgets and IT, I write with pleasure stealthsettings.com from 2006 and I like to discover with you new things about computers and operating systems macOS, Linux, Windows, iOS and Android.

Leave a Comment