du and df do rather similar things, and so I always find myself typing the wrong one.

I think if I knew what "du" and "df" stands for it might make it easier to remember which to use.

What is a way to differentiate between these two so I can remember which does which action?

  • 9
    Hah, Unix & Linux's tag autofill has already partially answered my question! Way to go! (I had tagged the question du, and after submission it autofilled it to disk-usage) – Cory Klein Jun 28 '12 at 16:00
  • 2
    Nice, stackexchange win! – Tim Jun 28 '12 at 17:20
  • 1
    For what it's worth, df looks at the file system, so I always mapped df with f with that – user606723 Jun 28 '12 at 20:34

du == Disk Usage. It walks through directory tree and counts the sum size of all files therein. It may not output exact information due to the possibility of unreadable files, hardlinks in directory tree, etc. It will show information about the specific directory requested. Think, "How much disk space is being used by these files?"

df == Disk Free. Looks at disk used blocks directly in filesystem metadata. Because of this it returns much faster that du but can only show info about the entire disk/partition. Think, "How much free disk space do I have?"

  • 1
    Actually I would argue that du stands for "Directory Usage" (but yes, it is debatable :-P ) – Patrick Jun 28 '12 at 22:27
  • 7
    By the way even in the man page is written du - display disk usage statistics. – rush Jun 29 '12 at 12:55
  • But is shows directory usage. Disk usage is what df does. So perhaps the man-page is the source of confusion here... – Nils Jun 29 '12 at 19:23
  • 7
    I was going to say that! +1 for beating me to it. I think "disk usage" is more appropriate than "directory usage" if you think of it as "disk usage for the files named as arguments." You can feed du(1) a long list of files, and it won't show any directory stats at all. – Jan Steinman Jul 4 '12 at 17:50
  • To me, "disk usage" could be interpreted as "disk usage for all my files", but "disk free" is certainly explicit. – Sparhawk Feb 3 '16 at 1:56

du is used more than df in day to day project as it shows the disk usage as per directory level.

df is disk free space and shows at file system level. Another command is dfspace which would also be used.

  • 1
    What's dfspace? How would I install it? It's not in the Debian repositories and I've never heard of it. – terdon Apr 9 '15 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.