mediumMultiple ChoiceObjective-mapped
XK0-006 Practice Question: Which command will display the disk usage of each…
Which command will display the disk usage of each file and directory in the current directory?
⚠ Common exam trap
CompTIA often tests the distinction between `df` (filesystem-level) and `du` (directory/file-level) disk usage, and the trap here is that candidates mistakenly choose `ls -lh` thinking it shows disk usage, when it only shows logical file size and does not account for blocks or directory contents.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
du -sh *
`du -sh *` calculates and displays the disk usage of each file and directory in the current directory. The `-s` flag summarizes each item, `-h` provides human-readable sizes (e.g., KB, MB), and the `*` wildcard expands to all non-hidden entries in the current directory, making it the precise command for this task.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
df -h
Why it's wrong here
df shows disk usage of mounted filesystems, not individual files.
- ✗
ls -lh
Why it's wrong here
ls shows file sizes but not cumulative directory sizes.
- ✓
du -sh *
Why this is correct
du -sh * displays the total size of each file/directory in human-readable format.
- ✗
fdisk -l
Why it's wrong here
fdisk lists partition tables, not disk usage.
Go deeper
Related to this question
About these practice questions
This XK0-006 question is part of Courseiva's 979-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This XK0-006 practice question is part of Courseiva's free CompTIA certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the XK0-006 exam.