du command : Displays disk usage space for each file and directory
command format:du [options] [file]
-K or--kilobytes output in kilobytes (1024bytes).
-M or--megabytes is output in megabytes.
-S or--summarize displays only the totals, listing only the last added total value.
-H or--human-readable to improve readability of the information in K,M,G units
[[email protected] test]# du608./test6308./test44./scf/lib4./scf/service/deploy/product4./scf/service/deploy/info12./scf/service/deploy16./scf/service4./scf/doc4./scf/bin32./SCF8./test31288 .[[email protected] test]#
Description: Displays only the directory size of subdirectories below the current directory and the total size of the current directory, and the bottom 1288 is the total size of the current directory.
DF Command : Used to check the disk space consumption of the Linux server's file system, this command can be used to get the amount of space occupied by the hard disk, and how much space is left.
command format:du [options] [file]
-h easy to read mode display
-H equals "-H", but the formula, 1k=1000, rather than 1k=1024
-I displays inode information and Linux uses a pointer-like approach to manage disk space mapping.
-K block is 1024 bytes
[Email protected] log]# df-h
File system capacity has been used with available% mount points
/dev/sda7 19G 871M 18G 5%/
/DEV/SDA9 195G 89G 96G 49%/opt
/dev/sda8 4.8G 557M 4.0G 13%/var
/dev/sda6 19G 1.9G 17G 11%/usr
/dev/sda3 965M 24M 892M 3%/boot
Tmpfs 16G 0 16G 0%/dev/shm
The difference between Du and DF:
Du is to calculate the size of each file by searching for files and then add up, du can see the files are only some of the current, not deleted. The size of his calculations is the cumulative sum of all the file sizes that he currently thinks exist.
DF through the file system to quickly get the information about the size of the space, when we delete a file, the file is not immediately disappear in the file system, but temporarily disappeared, when all the programs are not used, will be released according to the rules of the OS deleted files, DF records the size of files obtained through the file system, where he is able to see the deleted files more than Du, and when the size is calculated, this part of the space is added, more accurate.
When the file system also determines that the file has been deleted, the Du and DF coincide.
Linux du with df command