How does `df` command differ?

QuestionsQuestions4 SkillsProDec, 10 2025
0124

That's an excellent question! It's very common to confuse du and df.

While du (disk usage) reports the disk space used by files and directories within a specified path (like what we just learned about in this step), df (disk free) reports information about the total disk space, used space, and available space on file systems.

Think of it this way:

  • du tells you how much space a specific file or directory is consuming.
  • df tells you how much space is left on the entire disk partition or filesystem.

For example, if you run df -h, you'll see output like this (though yours will vary):

Filesystem      Size  Used Avail Use% Mounted on
udev            7.8G     0  7.8G   0% /dev
tmpfs           1.6G  1.2M  1.6G   1% /run
/dev/sda1        50G   15G   33G  31% /
tmpfs           7.8G     0  7.8G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           7.8G     0  7.8G   0% /sys/fs/cgroup
...

Notice how it shows information per filesystem (/dev/sda1 is a common one for your main disk partition), including the total size, how much is used, how much is available, and the percentage used.

Does that help clarify the main difference between du and df?

0 Comments

no data
Be the first to share your comment!