$du
Estimate file and directory space usage.
du [OPTIONS] [FILE...]Try `du` Live in Interactive Sandbox
Zero-install client simulation with real-time feedback.
Overview & How du Works
`du` (Disk Usage) measures the space occupied by individual files and folders on disk. Unlike `df` which inspects entire partitions, `du` recursively scans directories to identify which folders or log files are consuming disk space.
Common Flags & Command Options
| Flag / Option | Description |
|---|---|
| -s, --summarize | Display only a total sum for each specified directory argument. |
| -h, --human-readable | Print sizes in human readable format (e.g., 24K, 500M, 4G). |
| -d, --max-depth=N | Print total for a directory only if it is N or fewer levels below. |
Practical Real-World Examples
du -sh /var/logOutputs the total human-readable size of the /var/log directory.
Frequently Asked Questions
What is the fastest command to find the largest directories on Linux?
Run `du -sh /* 2>/dev/null | sort -hr | head -n 10` to display the top 10 largest folders sorted by size.
Related Linux Commands
Search for files and directories in a directory hierarchy based on name, type, size, or modification date.
List directory contents including file sizes, permissions, ownership, and modification timestamps.
Report file system disk space usage across mounted storage partitions.
Display total amount of free and used physical memory and swap.