Courseiva
System Management →mediumMultiple Select

XK0-006 System Management Practice Question

An administrator wants to gather information about disk usage for a specific directory and its subdirectories. Which TWO commands can be used for this purpose? (Choose two.)

⚠ Common exam trap

XK0-006 often tests the du vs df distinction — candidates pick df because it also reports 'disk usage,' missing that df is filesystem-level and du is directory-level.

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 /path

Du reports disk usage for the specified directory and, by default, recurses into its subdirectories, while -s summarizes the total into a single figure and -h presents it in human-readable units. Option D (du -h /path) is also correct because du -h /path likewise walks the directory tree and prints the disk usage of the directory and each subdirectory in human-readable form, satisfying the requirement to gather usage information for the directory and its subdirectories. Option B (df -h /path) is not correct because df reports filesystem-level free and used space for the mount point containing the path, not per-directory or per-subdirectory usage. Option C (ls -lh /path) is not correct because ls only lists file and directory entries with their sizes, without recursively totaling the disk usage of subdirectory contents. Option E (stat /path) is not correct because stat displays metadata such as inode, permissions, and timestamps for a single file or directory, not aggregated disk usage across a directory tree.

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 -sh /path

    Why this is correct

    The -s flag collapses output to a single summary total for the directory, while -h renders sizes in human-readable units. Together they report total disk usage for /path and everything beneath it, satisfying the requirement to gather usage across the directory and its subdirectories.

  • ✗

    df -h /path

    Why it's wrong here

    df shows filesystem usage, not directory usage.

  • ✗

    ls -lh /path

    Why it's wrong here

    ls -lh lists immediate directory entries with human-readable sizes; it does not recurse into subdirectories or aggregate their consumption. It is tempting because it shows sizes per path, and would be correct for a quick listing of one directory's contents, not cumulative usage across a tree.

  • ✓

    du -h /path

    Why this is correct

    Without -s, du recurses through /path and prints a human-readable line for every subdirectory, giving the per-directory breakdown the task requires. The -h flag converts blocks to KB, MB and GB, satisfying the human-readable reporting need while covering all subdirectories.

  • ✗

    stat /path

    Why it's wrong here

    stat returns metadata for a single file or directory inode — size, timestamps, permissions — without recursing into subdirectories or summing their usage. It is tempting as a per-path inspection tool, and would be correct for reading one file's attributes, not directory-tree totals.

About these practice questions

This XK0-006 question is part of Courseiva's 781-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 →

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 CompTIA exam blueprint

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.