Linux disk query instruction

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
  1. Count the number of directories under the / home folder
ls -l /home | grep "^d" | wc -l
  1. Count the number of files in the / home folder, including subfolders
ls -lR /home grep "^_" wc -l
  1. 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
Published 48 original articles · Likes0 · Visits 282

Guess you like

Origin blog.csdn.net/qq_44971387/article/details/105344309