DU vs DF – Why du and df show different results in Linux?
Basic Definition:
df(Disk Free):
df reads disk blocks directly in the filesystem metadata and its trust on the superblock information . df reads the deleted file information also which is open in the running process. This always happens in case of big directory deletion which is used by large audiences. This command reads how much disk is totally free and trust filesystem metadata. This is the reason it gives you faster results.
du(Disk Usage):
du reads every file in the directory and read their size. If any file deleted and open in the running process, it will not take any reference of the deleted file. du relies on which file currently in the directory and what is actual size. This is the reason it is slower than the df.
Conclusion:
We can say df work on the filesystem and on the other hand du work on files.