commands
du — Estimate file space usage
Estimate allocated usage; -b reports apparent bytes with GNU du. Hard links, sparse files and shared extents affect interpretation. Use a fresh private workspace; live operations are VM-only.
Formal Syntax & Structure
linux syntaxlinux
du [OPTIONS] [FILE ...]Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| -b | option | Apparent bytes |
| -s | option | Summarize |
| -h | option | Human readable |
| FILE | operand | File or directory to measure; defaults to current directory when omitted. |
Return Value
exit status and output
GNU du prints usage estimates (or apparent size with -b) and returns nonzero on traversal/reporting errors. Partial totals may be printed before errors, so inspect diagnostics and scope.
Working Example
Example Snippetlinux
truncate -s 1048576 ./sparse.imgdu -b ./sparse.img