Du command: Disk usage, as the name implies, is about directory usage, and its function is to calculate the size of the directory.
1.
To see the size of all directories and subdirectories in the current directory:
# du-h.
“.” Represents the current directory. can also be replaced by a clear path
-h means to display the human form of K, M and G
2.
Just want to see the size of the ABC directory under the current directory, and don't want to look at other directories and their subdirectories:
# DU-CH ABC | Tail-n 1
This method requires pipeline technology to pipe du and tail two commands to implement.
-C indicates that the sum of the sizes of all listed directories is finally calculated
# DU-SH ABC
-S means that a summary value is listed only
# du-h–max-depth=0 ABC
–max-depth=n means that only deep into the nth-level directory, where set to 0, means not to go deep into subdirectories.
3.
Lists the size of all directories and files under the ABC directory and its subdirectories:
# Du-ah ABC
-a means including directories and files
4.
Lists the size of the directory names in all ABC directories that do not include the XYZ string:
# du-h–exclude= ' *xyz* ' ABC
5.
To get more information about the ABC directory and the size of subdirectories on one screen:
# du-0h ABC
0 (bar 0) indicates the information for each directory listed, not wrapping, but outputting the information of the next directory directly.
Du and DF are often used together, sometimes with insufficient disk space, to find large disk space paths next to each other. You can also use the Find command to view the location of large files.
The most I use is du-sh *; ---can list the size of all files and folders in the current directory.
Advanced use of Linux commands du