-
df: View the size of the partition
du: View the file and directory size
Learn Linux operation and maintenance with an old boy: core command practice", you can go to JD.com to buy books.
-
First, the difference between du and df commands, check the instructions on the Internet and understand it as follows:
du is the size of each directory directly, and the df that does not get the information from the hard disk is calculated from the hard disk information.
So sometimes you will encounter the value of du that is too far away from the value of df, this is because when an application is writing to a large file, the Linux operating system allows rm and mv, and the application will take the handle and write directly to the disk based on the disk location that the handle refers to, without checking if the file is deleted.
Second, the relevant order lsof
The following command deletes files that have been deleted from the hard drive, but have not yet freed up space from the process.
for i in `lsof |grep file_20090828*.log |awk ''` ;do kill -9 $i ;done
-
1. The df command is used to query the usage of the entire file system; The du command only counts the space used by directories or files (for directories, recursively). Therefore, the space queried by DF is larger than that of DU.
2. The implementation of the df command is to query the information of the file system by calling the function statfs, which is stored in the file system; du uses the opendir() and stat() functions to query the file size and accumulate the results.
-
df is a command to view the remaining space and usage of the disk, which can list the usage of all partitions; Du is to view the usage of the directory, with a different focus.
The df and du commands are used above, respectively. As you can see, DF lists the total disk capacity, available capacity, usage, and access points, while the DU only aggregates the disk usage. The -h option indicates a user-friendly display format.
-
The reason is simple, because they are different orders
The df command is an abbreviation for disk free, which evaluates the disk space usage of the entire file system.
The du command is an abbreviation for disk usage, which evaluates the space usage of files and directory disks.
If you carefully understand the difference between "the entire file system" and "files and directories", you will be able to understand the difference between the df and du commands.
-
du will count all files, directories, and files in the specified directory. It's based on what the file system can see, and there are indeed some such files. In other words, the files that can be seen in the file system will be counted by du.
The df command calculates the total number of blocks and the number of remaining blocks by viewing the file system disk block allocation chart. Take the statistics of the disk usage of the current directory as an example, and you can understand it by comparing it. The execution effect is shown in the following figure:
Note: Obviously, DU is just a statistic of file usage, while DF is a disk block.
-
The du command can display the disk space occupied by the current directory, and the df command can display the remaining disk space of the current disk. If the du command does not add any parameters, it returns the usage of the entire disk, and if the directory is added to it, it is the usage of the directory on the disk. The options of the du command in Linux are as follows:
s only gives the total number of data blocks occupied for each names parameter.
a Recursively displays the number of data blocks occupied by each file in the specified directory and each file in the descendant directory. If -s or -a is not specified, only the number of disk blocks occupied by each directory and its subdirectories in names is displayed.
b Lists disk space usage in bytes (system megabytes are measured in kilobytes by default).
k Lists disk space usage in 1024 bytes.
c Add a total at the end (the system default).
l Counts all file sizes, and for hard-linked files, multiple times.
x Skipping the Changchang directory on a different file system is not counted.
In Heroes: Feudal means 0-4 and Everyday means 5-9. That is, Everyday means more than Few. In addition, few is negative, "only these 0-4, not worth mentioning".
The differences are as follows:First, the meaning is different:1. The action is not strong, and the meaning is very empty. >>>More
The meaning of "to": to arrive, the extreme, the most.
To "to" means: to concentrate; Reach realization; Attract; Taste; Filigree. >>>More
The J-8 DF is an improved version on the basis of the J-8F and J-8H, which mainly adds a new type of air-to-air missile, upgrades the integrated fire control system, and adds avionics equipment such as data link, double-stick control, one flat and two down, integrated display control, helmet sight, integrated transmission and recording equipment, voice alarm, etc., to improve the medium-range combat capability and comprehensive combat capability.
When guiding the temporal adverbial clause, including while, it is absolutely correct to use when. But there is a usage while when not, and that is table comparison.