Groups and Filtering
Outcome: you can make duf show exactly the slice of the machine you mean — only the real disks, none of the plumbing — and you know how to see the whole unedited list when the tidied one is hiding something. There are four filtering tools, and they compose.
By group: --only and --hide
The groups of chapter 2 — local,
network, fuse, special,
loops, binds — are the vocabulary
of the broad filters:
./duf --only local # the storage you think of as disks
./duf --hide special # everything except the plumbing
On the lab machine --only local
reduced the answer to one table of
19 rows and --hide special removed
the 34-row special table — the single
most useful flag pair in the tool,
because most days the special mounts
are noise. --only network on the
lab machine printed nothing and
exited successfully: there are no
network filesystems there, and an
empty answer to a group question is
a fact, not an error. An unknown
group name, by contrast, is an
error: duf answers unknown device
group: bogus and stops.
By filesystem type: --only-fs and --hide-fs
./duf --only-fs tmpfs --only special
Type names are the kernel's own —
tmpfs, btrfs, overlay, ext4,
nfs — comma-separated when you
want several. The lab used this pair
to count a machine's memory
filesystems without the rest of the
special crowd.
By mount point: --only-mp and --hide-mp
Mount-point filters accept exact paths and wildcards:
./duf --only-mp "/home/*"
./duf --hide-mp "/run/*" --only special
The lab's /home/* question was
answered by four local and four
special mounts living under that
tree; its /run/* hiding took the
special table from 34 rows to 22.
Wildcards make mount-point filters
the right tool for "everything under
this part of the tree" — a question
df can only be made to answer with
a pipeline.
Switching the tidy filter off: --all
Every filter above works within the default view — the edited list of chapter 2. The edit itself is controlled by one flag:
./duf --all
On the lab machine this grew the
answer from 53 rows to 76 — every
mount the kernel lists, pseudo,
duplicate and inaccessible included,
with the root filesystem back in its
place at the top of the local table.
Reach for --all whenever a
filesystem you expect is missing, a
path argument comes back silent, or
a count matters more than tidiness.
Reach for the group, type and
mount-point filters when the whole
list is in front of you and the
question is narrower than the
machine.