Query the disk usage of the specified directory
Basic grammar
du -h /目录
Query the disk usage of the specified directory, the default is the current directory
-s Specifies the size of the directory occupancy summary
-h with unit of measurement
-a with file
-max-depth = 1 sub-directory depth
-c while listing the details, increase the summary value
Applications
Query the disk usage of the / opt directory, the depth is 1
du -ach --max-depth /opt
Disk condition-practical instructions
Count the number of files in the / home folder
ls -l /home | grep "^_" | wc -l
- Count the number of directories under the / home folder
ls -l /home | grep "^d" | wc -l
- Count the number of files in the / home folder, including subfolders
ls -lR /home grep "^_" wc -l
- Count the number of directories in a folder, including those in subfolders
ls -lR /home | grep "^d" | wc -l
Show directory structure in a tree
yum instal tree
tree