LFCS Storage Management Practice Question
An administrator receives a report that a specific directory /var/log is consuming too much disk space. Which command should be used to determine the total disk space used by that directory?
⚠ Common exam trap
Many candidates confuse `df` (filesystem-level usage) with `du` (directory-level usage), often selecting `df -h` because it shows disk space, without realizing it reports on the entire partition rather than the specific directory.
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 /var/log
The `du -sh /var/log` command calculates the total disk space used by the specified directory. The `-s` flag summarizes the total size, `-h` provides human-readable output (e.g., in KB, MB, GB), and the path `/var/log` targets the directory in question. This is the standard Linux command for determining directory disk usage.
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 /var/log
Why it's wrong here
df shows disk usage of the filesystem, not the directory.
- ✗
ls -la /var/log
Why it's wrong here
ls lists files but does not sum sizes recursively.
- ✗
fdisk /var/log
Why it's wrong here
fdisk is for partition manipulation, not directory size.
- ✓
du -sh /var/log
Why this is correct
du -sh calculates the total size of the directory.
Go deeper
Related to this question
About these practice questions
Courseiva writes every LFCS question from scratch — 507 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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 LFCS practice question is part of Courseiva's free Linux Foundation 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 LFCS exam.