Operations 11 min read

Master Linux Disk Inspection with the ‘di’ Tool: Features, Options, and Real‑World Examples

This article introduces the Linux ‘di’ command‑line utility, compares it with the traditional df tool, and provides a step‑by‑step tutorial covering its most useful options, output formats, sorting capabilities, and practical advantages and drawbacks for system administrators.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Linux Disk Inspection with the ‘di’ Tool: Features, Options, and Real‑World Examples

Introduction

If you regularly use df to check filesystem usage, you may have noticed its limited output options. The di utility offers all of df 's features plus many advanced capabilities such as custom units, detailed field selection, and flexible formatting.

Test Environment

OS – Ubuntu 13.04

Shell – Bash 4.2.45

Application – di 4.30

Short Tutorial

1. Default output

$ di Filesystem Mount Size Used Avail % Used fs Type /dev/sda6 / 28.1G 20.2G 6.5G 77% ext4 udev /dev 1.5G 0.0G 1.5G 0% devtmpfs tmpfs /run 300.2M 0.9M 299.3M 0% tmpfs

The default format presents human‑readable sizes (G, M) and a clear column layout.

2. Show all fields with -A

$ di -A Mount fs Type Options Size Used Avail % Inodes Iused Ifree % ... (full table omitted for brevity)

This option prints every available field, useful for debugging.

3. List all mount devices with -a

$ di -a /dev/sda6 / 28.1G 20.2G 6.5G 77% ext4 udev /dev 1.5G 0.0G 1.5G 0% devtmpfs ...

All mounted devices are displayed.

4. Use comma as value separator with -c

$ di -c /dev/sda6,/ ,28.1G,20.2G,6.5G,77,ext4 udev,/dev,1.5G,0.0G,1.5G,0,devtmpfs

The comma‑separated output is convenient for feeding into scripts.

5. Print sizes in gigabytes with -g

$ di -g /dev/sda6 / 28.1 20.2 6.5 77% ext4

Values are shown in GiB; -k and -m provide KiB and MiB respectively.

6. Filter by filesystem type with -I

$ di -I tmpfs tmpfs /run 300.2M 0.9M 299.3M 0% tmpfs

Only entries matching the specified type are printed.

7. Omit the header line with -n

$ di -n /dev/sda6 / 28.1G 20.2G 6.5G 77% ext4 tmpfs /run 300.2M 0.9M 299.3M 0% tmpfs

Useful when parsing the output programmatically.

8. Add a total line with -t

$ di -t ... (individual rows) ... Total 29.9G 20.2G 8.3G 72%

The final line aggregates size, used, and free space across all filesystems.

9. Sort output with -s

$ di -sr ... (sorted in reverse order) ...

Sorting can be based on mount point, device name, filesystem type, or disabled entirely; the r flag reverses the order.

10. Custom format strings with -f

$ di -fm /dev /run

Only the mount point names are printed. Using -ft prints just the filesystem types.

Advantages

Provides many advanced features beyond df.

Cross‑platform and works on any Linux distribution.

Disadvantages

Not pre‑installed on most Linux distributions.

The large number of options requires a learning curve.

Conclusion

The di command is a powerful, feature‑rich replacement for df, offering flexible units, extensive field selection, custom formatting, and sorting. For administrators needing more insight into disk usage, di is a highly recommended tool.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

linuxSysadminBashdidiskcommand-line
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.