Does the -h option change the units of disk space usage in the du command?

QuestionsQuestions4 SkillsProDec, 19 2025
0168

Yes, it does!

By default, the du command displays sizes in kilobytes (KB). This can sometimes result in large numbers that are hard to read quickly (as you saw in your history when du --max-depth=0 showed 5120).

The -h option stands for "--human-readable". When you use it:

  1. Unit Conversion: It automatically converts the numbers into higher units like Megabytes (M), Gigabytes (G), or Terabytes (T) whenever appropriate.
  2. Readability: Instead of seeing 5120, you see 5.0M. This makes it much easier to understand at a glance how much space a directory is actually consuming.

In your current lab step, comparing these two commands highlights the difference:

  • du --max-depth=0 (shows 5120 — raw KB)
  • du -h --max-depth=0 (shows 5.0M — human-readable)

Keep going with the next steps! You're doing great.

0 Comments

no data
Be the first to share your comment!