Linux command _ view the capacity of a disk or directory

Software environment: virtual machine VM12, Linux version CentOS 7.3

Command df (disk filesystem)

It is used to view the total capacity, used capacity, remaining capacity, etc. of the mounted disk, without adding any parameters, and the default is displayed in KB.

In the result of the above example:

  • / , /boot are divided when we install the system. (For details, please refer to the installation of the Linux operating system )
  • /dev, /dev/shm are memory partitions, the default size is 1/2 of the memory size, and storing files in this partition is equivalent to existing in the memory. The advantage is that the read and write speed is very fast. lost .
  • Partitions such as /run and /sys/fs/cgroup are all tmpfs, similar to /dev/shm, which are temporary file systems.

 

The common options of the df command are -i, -h, -k, -m. The following will explain them one by one:

1. df -i: Check the usage status of inodes. If it is 100% used, even if there is surplus disk space, it will prompt that the disk space is full.

 

2, df -h: Display in appropriate units, such as GB.

 

3, df -k, -m: respectively indicate the display in KB and MB.

 

Instruction du (disk useage)

Used to view the size of the space occupied by a directory or file, the format is du [-abckmsh] [file or directory name] , the common parameters of this command are as follows:

1, du -a: indicates that the sizes of all files and directories are listed. If no options and arguments are followed, only the size of the directory (including subdirectories) will be listed. If the du command does not specify a unit, the default display unit is "KB".

 

 

2 , du - [bkmh]

  • du -b: Indicates that the listed values ​​are output in units of B.
  • du -k: Indicates output in KB (equivalent to du).
  • du -m: indicates output in MB.
  • du -h: Indicates that the system automatically adjusts the unit output.

 

3, du -c: indicates the final sum.

 

4, du -s: Indicates that only the sum is listed.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324973195&siteId=291194637
Recommended