In Linux systems, you can use the following command to check the hard disk space usage:
1. df -h: Check the space usage of the entire disk.
bashdf -h
The output result is similar to:
Filesystem Size Used Avail Use% Mounted on/dev/sda2 20G 2.8G 17G 15% //dev/sda1 477M 61M 416M 13% /boot/dev/sda3 905G 116G 744G 13% /home
The meaning of each column is:
– Filesystem: Partition name
– Size: Total partition space
– Used: Already Used space
– Avail: Available space
– Use%: Used percentage
– Mounted on: Mount point
2. du -sh: View the disk space occupied by the specified directory.
For example, to view the space usage of the /home directory:
bash du -sh /home
3. du -h –max-depth=1 /home: View the space occupied by each subdirectory under /home, only one layer is counted subdirectory.
bashdu -h --max-depth=1 /home
4. du -sh *: View the space occupied by each file and subdirectory in the current directory.
bashdu -sh *
5. ncdu: A simple CLI disk space usage analysis tool. Visualization shows the space occupied by each subdirectory, and can be interactively analyzed in more detail.
Installation method:
bashsudo apt install ncdu # Ubuntusudo yum install ncdu # CentOS
Usage method:
bashncdu /home # 分析/home目录空间使用
This article introduces several commonly used disk space analysis methods and commands in Linux. Including:
– df -h: View the space usage of the entire disk
– du -sh: View the disk space occupied by the specified directory
– du -h –max-depth=1 /home : Check the space occupied by each subdirectory under /home, only one level is counted
– du -sh *: Check the space occupied by each file and subdirectory under the current directory
– ncdu: A simple CLI disk space usage analysis tool
The above is the detailed content of Check hard disk usage in linux (check disk usage in linux). For more information, please follow other related articles on the PHP Chinese website!