Linux

du

Estimate file space usage.

#linux #disk #storage

Basic Usage

Show disk usage of current directory.

du [path]

Human Readable

Show sizes in human readable format (K, M, G).

du -h [path]

Summary Only

Show only the total size of the directory.

du -sh [path]

Max Depth

Limit the depth of directory traversal.

du -h --max-depth=1 [path]

Sort by Size

List directories sorted by size.

du -h [path] | sort -h

Exclude Pattern

Exclude files matching a pattern.

du -h --exclude="*.log" [path]