LinuxCommandLibrary

duf

Display disk usage information

TLDR

List accessible devices

$ duf
copy

List everything (such as pseudo, duplicate or inaccessible file systems)
$ duf --all
copy

Only show specified devices or mount points
$ duf [path/to/directory1 path/to/directory2 ...]
copy

Sort the output by a specified criteria
$ duf --sort [size|used|avail|usage]
copy

Show or hide specific filesystems
$ duf --[only-fs|hide-fs] [tmpfs|vfat|ext4|xfs]
copy

Sort the output by key
$ duf --sort [mountpoint|size|used|avail|usage|inodes|inodes_used|inodes_avail|inodes_usage|type|filesystem]
copy

Change the theme (if duf fails to use the right theme)
$ duf --theme [dark|light]
copy

SYNOPSIS

duf [options] [path...]

Examples:
duf
duf /home /var
duf -h -a

PARAMETERS

--all-local, -l
    Show only local file systems.

--all, -a
    Show all file systems, including pseudo ones.

--inodes, -i
    Display inode information instead of disk usage.

--output=FIELDS
    Specify which output fields to display.

--sort=FIELD
    Sort the output by a specific field (e.g., SIZE, USED, USAGE, INODES, FILESYSTEM).

--raw
    Display raw values without formatting (e.g., bytes instead of GB).

--style=STYLE
    Set the output style (e.g., unicode, ascii, basic).

--theme=THEME
    Set the color theme.

--hide-fs=REGEXP
    Hide filesystems matching the given regular expression.

--only-fs=REGEXP
    Show only filesystems matching the given regular expression.

--max-depth=N
    Set the maximum directory display depth when showing directory usage.

--total
    Display a grand total for all listed file systems.

--help, -h
    Show help message and exit.

--version, -v
    Show version information and exit.

DESCRIPTION

duf is a modern, user-friendly utility designed to replace or complement traditional Linux commands like df and du. Written in Go, it offers a more visually appealing and intuitive way to display disk usage and free space information. Unlike its predecessors, duf provides a color-coded, tabular output that's easy to read at a glance, often including ASCII or Unicode graphs for a quick visual representation of disk fullness.

It can list information about all mounted filesystems, specific mount points, or even calculate the disk usage of specified directories and files, similar to how du operates. Its output is highly customizable, allowing users to select specific fields, sort by various criteria, and filter results. This makes duf an excellent tool for quick system health checks and identifying large files or directories, providing a much more pleasant user experience.

CAVEATS

duf is a third-party utility, not part of the standard core GNU utilities found on all Linux distributions by default. It typically needs to be installed separately. While its rich formatting is excellent for human readability, it makes duf less suitable for parsing in shell scripts compared to the more structured output of traditional commands like df or du, unless the --raw option is used.

INSTALLATION

duf is typically available in package managers for most popular Linux distributions (e.g., sudo apt install duf on Debian/Ubuntu, sudo dnf install duf on Fedora). It can also be installed by downloading pre-compiled binaries from its GitHub releases page or by compiling from source.

HISTORY

duf was developed relatively recently, written in the Go programming language by Christian Schauer. Its creation was motivated by a desire to provide a more visually appealing and user-friendly alternative to the aging df and du commands, which often present information in a less intuitive format. Since its initial release, duf has gained considerable popularity among Linux users for its modern interface, clear output, and versatility in handling both filesystem and directory usage information.

SEE ALSO

df(1), du(1), ncdu(1), lsblk(8)

Copied to clipboard