Disk usage summary on Unix/Linux: Which command is used to summarize per-file and per-directory disk space consumption for quick assessment?

Difficulty: Easy

Correct Answer: du

Explanation:


Introduction / Context:
Administrators frequently need to identify which directories or files consume space. Unix provides standard utilities to summarize disk usage efficiently, assisting in cleanup, quota checks, and capacity planning.



Given Data / Assumptions:

  • We are in a Unix/Linux environment.
  • The goal is to summarize disk usage by directory and file.
  • Only standard command names are considered; no third-party tools.


Concept / Approach:

The du command (disk usage) reports the number of blocks or human-readable sizes used by files and directories. Options like -s (summary) and -h (human-readable) are common combinations. Other listed commands are from different ecosystems or serve different purposes.



Step-by-Step Solution:

Identify the Unix utility for space reporting at the file/directory level: 'du'.Optional flags: 'du -sh ' to summarize top-level items with readable units.Confirm that 'chkdsk' (DOS/Windows) and 'fdisk' (partitioning) are not relevant to usage summarization.Note that 'disk' is not a standard Unix utility for this purpose.


Verification / Alternative check:

Running du -sh /var/ quickly reveals which subdirectories occupy the most space. This is the canonical approach for Unix-like systems.



Why Other Options Are Wrong:

  • chkdsk: DOS/Windows filesystem checking tool, not a Unix usage reporter.
  • fdisk: Partition table editor; unrelated to per-directory usage.
  • disk: Not the standard tool for usage in Unix.
  • None of the above: Incorrect because 'du' is correct.


Common Pitfalls:

Confusing 'du' with 'df'. df reports filesystem-level free/used space; du drills down into directories and files. For complete analysis, both are useful together.



Final Answer:

du

More Questions from Unix

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion