Bird
0
0

You want to find the top 3 largest subdirectories inside /var using du. Which command will correctly do this?

hard📝 Application Q8 of 15
Linux CLI - Disk and Storage
You want to find the top 3 largest subdirectories inside /var using du. Which command will correctly do this?
Adu -a /var | sort -h | tail -3
Bdu -h /var | sort -hr | head -3
Cdu -sh /var/* | sort -hr | head -3
Ddu -csh /var | sort -hr | head -3
Step-by-Step Solution
Solution:
  1. Step 1: Understand the goal

    We want sizes of immediate subdirectories only, summarized, sorted by size descending, top 3.
  2. Step 2: Analyze options

    du -sh /var/* summarizes each subdirectory; sorting numerically human-readable with sort -hr works; head -3 picks top 3.
  3. Final Answer:

    du -sh /var/* | sort -hr | head -3 -> Option C
  4. Quick Check:

    Summarize subdirs + sort human-readable + top 3 = du -sh /var/* | sort -hr | head -3 [OK]
Quick Trick: Use du -sh /dir/* to summarize subdirs [OK]
Common Mistakes:
  • Using du -a lists files too
  • Sorting ascending instead of descending

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes