The Du (disk usage) command calculates the disk space that a file or directory occupies. When you do not specify any options, it measures the current working directory and all its subdirectories, showing the number of directories that are accounted for by each directory, and then displays the total speed of the working directory.
Du [OPTION] ... [FILE] ...
Includes all the files, not just directories.
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 in bytes as unit of calculation
-K in kilobytes (KB) as a unit of calculation
-M in megabytes (m) as a unit of calculation
-c,–total finally add a total (system default)
Dereference FILEs that are symbolic links
The-H and--si effect is the same.
-h,–human-readable Output File size information (for example, 1K 234M 2G) in a more readable manner. Note: This option is also available in many other commands (DF, LS).
–si is the same as the-H effect, only 1000 is the conversion unit
-l,–count-links calculates all file sizes and calculates multiple times for hard linked files.
-l,–dereference the source file size of the symbol connection specified in the Display option.
-p,–no-dereference does not follow any symbolic connections (default)
-s,–separate-dirs does not include the size of subdirectories when calculating the space occupied by the directory.
-s,–summarize displays only the total space occupied by the working directory
-x,–one-file-system the file system at the start of the process, if you encounter a different file system directory, skip.
-X File,–exclude-from=file excludes the specified FILE
–exclude=pattern excludes files that match the style, pattern is the normal shell style,? represents any character, * represents any number of characters.
Lists only the information for directories and files with depths less than max-depth –max-depth=0 the effect is the same as –s
793832. – Do not specify a file name to calculate the amount of space occupied by the current directory.
776M. – Do not specify a file name to calculate the amount of space occupied by the current directory. The-h option makes the output easier to read (compared to the previous example)
– Output the space used by each subdirectory under the current directory
Find large files
When disk space is depleted, it is unavoidable to clean up, for example, the/home directory is too large, you can use the following command to see who it is:
Du-s/home/* | Sort-nr