Linux for Developers Course
Linux for Developers
/
Beginner

df

Definition

Disk Free. A command used to display the amount of available and used disk space on file systems.

Explain Like I'm New

The 'How full is my hard drive?' command.

Real World Example

A database crashes. The admin types `df -h`. The output shows `/dev/sda1` is `100%` full. The database crashed because it ran out of hard drive space.

Common Use Cases

  • •Disk space monitoring
  • •Preventing outages

Crucial Command Flags

Flag / OptionDescription
-hHuman-readable (e.g., 1K 234M 2G).
-iList inode information instead of block usage.
-TPrint file system type.

Interview Questions

basic

  • What does the highly popular `-h` flag do in the command `df -h`?

intermediate

  • Does `df` tell you exactly which specific folder is taking up all the space?

Flash Cards

Question

What is -h?

Click to reveal answer
Answer

Human-readable. Instead of printing disk space in millions of confusing bytes, it prints it in Megabytes (M) and Gigabytes (G).

Question

Does it show folders?

Click to reveal answer
Answer

No. `df` only shows the summary of the entire physical hard drive partition. To find out *which* folder is full, you must use the `du` command.