du Command in LINUX (original) (raw)

Last Updated : 18 May, 2026

The du (Disk Usage) command in Linux is used to estimate and display file and directory space usage. It helps users identify which files or directories consume the most disk space. This command is essential for system monitoring and storage management. By default, it shows usage recursively for directories.

Example: Display Disk Usage of a Directory

**Command:

du /home/gfg0913/Downloads

**Output:

du-dir

Syntax

du [OPTIONS] [FILE/DIRECTORY]

Options available in du command in Linux

The du command provides several options to customize output and control how disk usage is calculated and displayed.

Demonstration of du Options

1. -h (Human Readable)

Displays file and directory sizes in human-readable format (KB, MB, GB). This is useful when default block-size output is hard to interpret.

**Command:

du -h Downloads

**Output:

du-h

2. -a (All Files)

Shows disk usage for all files along with directories. Use this when you need detailed file-level disk usage instead of only directory summaries.

**Command:

du -a -h Downloads

**Output:

du-a-h

3. -c (Total)

Displays a grand total of disk usage along with individual entries. This is useful when you want an overall usage summary in the same output.

**Command:

du -c -h /home/gfg0913/Pictures/

**Output:

du-c-h-pictu

4. -d (Max Depth)

Shows disk usage only up to a specific directory level. This prevents too much detailed output from deeply nested folders.

**Command:

du -h -d 1 Pictures/

**Output:

du-h-d-1

**Command:

du -h -d 2 Pictures/

**Output:

du-h-d-2

5. -s (Summary)

Displays only the total disk usage of the specified directory without showing subdirectory details. Useful for quick checks.

**Command:

du -s /home/gfg0913/Downloads

**Output:

du-s

6. --time (Last Modified Time)

Shows the last modification time of files and directories along with their disk usage. Useful for identifying recently changed data.

**Command:

du --time -h /home/gfg0913/Downloads

**Output:

du---time-h