Courseiva
Essential Commands →mediumMultiple Choice

LFCS Essential Commands Practice Question

An administrator is diagnosing disk space and wants to see the total size of the /var/log directory and all its contents in human-readable units, without listing every individual file. Which command provides exactly this summary?

⚠ Common exam trap

The trap here is reaching for df because it also reports space; df describes the filesystem, while du describes the directory tree, and only the latter summarizes /var/log itself.

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 combination reports a single human-readable total for the specified directory tree, which is precisely the summary needed. The other commands either report filesystem-level capacity, list individual entries, or enumerate every file, none of which deliver a concise total for /var/log.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    du -ah /var/log

    Why it's wrong here

    The -a option tells du to print a line for every file in addition to directories, producing a long listing rather than a summary. Although -h makes the output human-readable, the command still enumerates all files, which the scenario explicitly wants to avoid. It therefore does not provide the concise total requested.

  • ✓

    du -sh /var/log

    Why this is correct

    The du command estimates file space usage, the -s option summarizes only the total for the specified directory rather than every subdirectory, and -h prints sizes in human-readable units such as K, M, and G. This produces a single concise line showing the total space consumed by /var/log and everything beneath it, exactly as requested.

  • ✗

    ls -lh /var/log

    Why it's wrong here

    The ls -lh command lists the entries inside /var/log with human-readable sizes, but it shows each file and subdirectory individually and reports directory entries as small fixed sizes rather than their recursive contents. It does not produce a single total for the whole tree, so it fails to give the summary the administrator needs.

  • ✗

    df -h /var/log

    Why it's wrong here

    The df command reports free and used space on the filesystem that contains the given path, not the size of the directory itself. Running this shows usage for the entire mount point, which could include many other directories. It does not summarize the contents of /var/log, so it answers a different question about filesystem capacity rather than directory size.

About these practice questions

One of 406 original LFCS practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Linux Foundation exam blueprint

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.