Disk Usage
Show how much disk space a directory or file uses with a single command.
Usage
du -sh <PATH>
Arguments:
| # | Name | Description |
|---|---|---|
| 1 | PATH | Path to file or directory to measure |
Example
du -sh /home/user/projects
Output:
1.2G /home/user/projects
Format: SIZE PATH
Success / Failure
- Success: One line with human-readable size and path (exit code 0)
- Failure: Error message (exit code non-zero, e.g. path not found)