Online Linux Terminal Logo
OnlineLinuxTerminal
Disk & StorageCLI Reference

$du

Estimate file and directory space usage.

Syntax DefinitionPOSIX standard
du [OPTIONS] [FILE...]
Linux Community2.4k Online

Chat with real Linux users, learn new commands & get free cheat sheet PDFs.

Try `du` Live in Interactive Sandbox

Zero-install client simulation with real-time feedback.

Open in Fullscreen Workspace↗
bash — terminal

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 / OptionDescription
-s, --summarizeDisplay only a total sum for each specified directory argument.
-h, --human-readablePrint sizes in human readable format (e.g., 24K, 500M, 4G).
-d, --max-depth=NPrint total for a directory only if it is N or fewer levels below.

Practical Real-World Examples

Example #1Check folder size summary
du -sh /var/log

Outputs the total human-readable size of the /var/log directory.

Sample Output:
142M /var/log

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.