What command displays disk usage of files and directories?

The story behind the answer

The command that displays disk usage for files and directories is `du`.

The name is short for “disk usage.” With no path specified, `du` examines the current working directory and reports storage allocated to its directory tree. It can also accept particular files or directories, making it useful for finding which folders consume space. The common `du -sh directory/` form gives a summarized, human-readable result.

Unlike `df`, which reports free and used space for entire mounted file systems, `du` walks directory trees and totals the space associated with their contents. That distinction explains why `du` and `df` can show different numbers: file-system overhead, reserved blocks, deleted-but-open files, and mount boundaries can affect the totals.

GNU and BSD versions commonly support `-h` for readable units such as MB or GiB, `-a` to include individual files, `-c` for a grand total, and `-x` to stay on one file system. `du` follows directory contents recursively by default, but symbolic links are generally reported as links rather than traversed targets unless an option requests otherwise.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: