Hi, I am Kiru 👋 an indie hacker, a problem solver and vim-lover. I build projects to make the life of others and mine easier.

This page is intended to collect all my projects and some thoughts.

What is the difference between `du` and `df` command?

TIL 14.03.2017

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

Learn more: