What is the difference between `du` and `df` command?
df
- stands for Disk Free
- calculates file size based on the file system meta information
- if block size is 8kb and file size is only 1kb then file size for
du
is 8kb - is faster but not accurate
du
- Disk Usage
- counts size used on the file system per file recursively (df and du giving different results)
- does not count open files
- does not rely on block size: 1kb file size with 8kb block size is still 1kb for
du
- is slow, but more reliable
See this post from Mike Golvach for thorough explanation: Why DU And DF Display Different Values On Linux And Unix