Syntax
UPPERCASE words are placeholders to replace. Brackets in the syntax line describe optional arguments; do not type those brackets literally.
du [OPTIONS] [PATH...]Example
du -sh -- .
du -s --block-size=1 -- .Expected result
A human-readable summary and a summary in bytes of allocated space for the current lab directory. This is not necessarily the sum of logical file lengths.
Notes and traps
GNU Coreutils syntax. Sparse files, hard links, permissions, mounts and open-but-unlinked files can make du and filesystem free-space reports differ. -- ends options; quote explicit paths. Do not run a broad recursive inspection over sensitive or expensive mounted trees without understanding its scope.
Try it
Create a small text file in an empty lab directory. Compare its byte length with du output. Why can a three-byte file consume more than three bytes of storage?
Answer and reasoning
Filesystems allocate storage in units larger than one byte, and directory metadata also consumes space. Logical length and allocated blocks answer different questions. du --apparent-size measures logical size on GNU du; it still does not replace filesystem-wide free-space accounting.
Related commands
Related tasks may need different flags and have different semantics. Check the entry before translating a command between shells.
Official reference ↗Updated 14 September 2026. Executed against a temporary directory with GNU Coreutils 9.4 on 14 September 2026; sparse/network-filesystem variants were not executed.