How to check hard disk space usage in Linux?

  In the Linux system, you can use commands to view the usage of hard disk space, among which the more common commands are: df and du. So how to use them specifically? This article will introduce you in detail, come and learn.

  check disk space -df

  The df command checks the usage of disk space in the file system in units of disk partitions.

  options:

  -h or --human-readable #Use a human-readable format, which is also a more common viewing method

  -i or --inode #View partition inode usage

  1. df command

  [whb@VM_0_12_centos test]$ df

  Filesystem: partition

  1K-blocks: total number of blocks

  Used: the number of blocks used

  Available: the number of blocks available

  Use%: utilization rate

  Mounted on: mount directory

  Note: Used+Available is not necessarily equal to 1k-blocks, because the system will reserve a part of the space for other uses

  2. df -h option

  Simply using the df command is not conducive to directly viewing the space usage in the partition, so we use df -h to view it more often. The -h option means -human-readable: use a human-readable format, which is also relatively common View as

  [whb@VM_0_12_centos test]$ df -h

  Filesystem Size Used Avail Use% Mounted on #Again: Size is not necessarily =Used+Avail

  3. df -i option

  How to view partition inode usage, use -i option

  [whb@VM_0_12_centos test]$ df

  Inodes: Number of inodes

  IUsed: the number of inodes used

  IFree: total number of remaining inodes

  check disk space -du

  The du command also checks the hard disk usage, but there are certain differences between the two.

  The du command is to count the hard disk space usage of files or directories and their subdirectories. Generally, it can help us quickly locate whether there are super large files or other special-sized files in the directory.

  The df command is to count the overall usage of the disk partition.

  The du command will directly search for all file data in a specific directory and accumulate statistics, so it will take a little time to execute the command.

  The df command extracts information directly from the file system, so it is relatively fast.

  options:

  -a or --all: #List all files and directory sizes instead of just listing directory sizes

  -s or --summarize: # only display the total, only list the last summed value

  -h or --human-readable: #In units of K, M, G, improve the readability of information

  -c or --total: #In addition to listing the capacity of files and directories, the total capacity is finally listed

  --max-depth=N: #The recursion depth of recursive display is less than or equal to N. --max-depth=0 is equivalent to the -s parameter

  How to use the options is not described in detail here.

Guess you like

Origin blog.csdn.net/oldboyedu1/article/details/131477872