LinuxCommandLibrary

duc

Index and inspect disk usage

TLDR

Index the /usr directory, writing to the default database location ~/.duc.db

$ duc index [/usr]
copy

List all files and directories under /usr/local, showing relative file sizes in a graph
$ duc ls [[-Fg|--classify --graph]] [/usr/local]
copy

List all files and directories under /usr/local using treeview recursively
$ duc ls [[-Fg|--classify --graph]] [[-R|--recursive]] [/usr/local]
copy

Start the graphical interface to explore the file system using sunburst graphs
$ duc gui [/usr]
copy

Run the ncurses console interface to explore the file system
$ duc ui [/usr]
copy

Dump database info
$ duc info
copy

SYNOPSIS

duc [options]... [path]...
duc subcommand [options]... [path]...

PARAMETERS

-a, --all
    show entries for directories with zero apparent size

-d N, --depth N
    limit output to directories of depth N

-D N, --max-depth N
    limit scan to directories of depth N

-h, --human
    print sizes in human readable format

-H, --si
    print sizes in SI format (powers of 1000)

-L N, --limit N
    limit number of entries

-o FILE, --database FILE
    store database in FILE

-s, --sum
    show only totals

-t N, --top N
    show top N entries

-x, --one-file-system
    skip directories on different file systems

--index-only
    only update index, no output

--clear
    clear database before indexing

DESCRIPTION

Duc (disk usage) is a powerful tool for analyzing disk space usage on Unix-like systems. It works by scanning directories once and storing the results in a compact, persistent database file. This allows for extremely fast subsequent queries and visualizations, far outperforming traditional tools like du for repeated analysis.

Key features include a full-screen curses-based interface (duc ui) for interactive browsing, tree and treemap views, HTML output for web reports, and command-line summaries. Users first run duc index /path to build the database, then query it with duc info, duc ui, or others. It supports filtering by size, depth limits, and multiple paths.

Duc is lightweight, handles large filesystems efficiently (e.g., millions of files), and provides precise breakdowns by directory, file type, or size buckets. Ideal for sysadmins identifying space hogs without rescanning entire drives each time. Supports GUI mode via duc gui using GTK or Qt.

CAVEATS

Requires initial indexing which can take time on large filesystems; database must be updated with --index-only or duc index after changes; not real-time.

SUBCOMMANDS

index: build/update database.
ui: curses interface.
gui: graphical interface.
info: text summary.
ls: directory listing.
svg: SVG treemap.

DATABASE

Stored as duc.db by default; compact binary format; auto-created in current dir or specified path.

HISTORY

Developed by Auke Kok starting in 2006; initial release 1.0 in 2010. Evolved to subcommands in v1.3 (2012); actively maintained with v1.5 in 2023 adding Qt GUI support.

SEE ALSO

du(1), ncdu(1), df(1), dstat(1)

Copied to clipboard