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 reports filesystem-level free and used space for the mount containing /var/log, not the total consumed by that directory's files. It is the right tool for checking partition capacity; measuring a directory's own usage requires du, which sums file sizes recursively.
- ✗
ls -la /var/log
Why it's wrong here
Listing entries with ls shows per-file metadata, not aggregate block usage, so it cannot total what /var/log consumes. It is tempting because it does reveal file sizes, and would suit identifying which individual files are largest before running du.
- ✗
fdisk /var/log
Why it's wrong here
fdisk partitions block devices; it reports and edits partition tables and cannot measure a directory's contents. It is tempting because it reports disk space, and would be correct when partitioning a new disk or inspecting /dev/sda layout.
- ✓
du -sh /var/log
Why this is correct
du -s summarises total usage for the directory rather than listing every file, and -h renders it in human-readable units. This directly answers the request for total space consumed by /var/log, unlike df, which reports filesystem-level usage.
Go deeper
Related to this question
About these practice questions
Courseiva writes every LFCS question from scratch — 406 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.