View the disk space occupied by directories and files

1. Check the total disk space usage

#View the current disk space usage of the system
 df -h

 

Second, check the disk space occupied by each directory and file

#Statistics the size of the disk space occupied by the current directory
 du -sh
#Count the size of all first-level subdirectories in the current directory
 du -h --max-depth = 1
#Count the size of all first-level subdirectories in the current directory and sort them
 du -h --max-depth=1 |sort
#Count all the first-level subdirectories of G in the current directory and sort them
 du -h --max-depth = 1 | grep 'G' | sort
#Count all the first-level subdirectories of T and G in the current directory and sort them in reverse order
 du -h --max-depth = 1 | grep [TG] | sort -nr

    
 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326609139&siteId=291194637