This original article belongs to the "Linux Greenhouse" blog.
The blog address is http://roclinux.cn.
Article author for Roc
I hope you can donate to support the operation and development of the Linux greenhouse blog. See "About Donations"
==
Du command: Disk usage, as the name implies, is about directory usage. Yes, it works by calculating 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* '
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 command-linux command five-minute series three