Skip to content

Width, Style and Themes

Outcome: duf's table fits the terminal — and the file — you actually have, and you know which parts of its appearance survive being piped. Everything here belongs to the renderer of chapter 2, and the lab's evidence comes with a confession built in: its terminal was a capture pipe, so this chapter separates what was measured from what is documented.

Width

Duf sizes its table to the terminal it finds. When output is piped — into a file, a capture, another program — there is no terminal to ask, and duf works at 80 columns (as every transcript in this guide shows). --width sets the maximum explicitly:

./duf --width 60 --only-mp /tmp

At 60 the table still draws, with headers wrapped mid-word (MOUNTED over ON, FILESY over STEM) and values split across lines. It is legible, barely, and it makes the renderer's priorities plain: the table is never truncated and never wider than allowed — space is taken from wrapping first, and from the usage bar before that (chapter 5). A wide terminal runs the other way: the bar returns and columns breathe. There is no flag to make duf print one line per mount regardless of width; for machine consumption, that is what --json is for.

Style

--style ascii swaps the Unicode box-drawing for plain ASCII:

./duf --style ascii --only-mp /tmp
+------------+--------+--------+--------+-----------------+-------+------------+
| MOUNTED ON |   SIZE |   USED |  AVAIL |       USE%      | TYPE  | FILESYSTEM |
+------------+--------+--------+--------+-----------------+-------+------------+
| /tmp       | 512.0M | 420.0K | 511.6M | [........] 0.1% | tmpfs | tmpfs      |
+------------+--------+--------+--------+-----------------+-------+------------+

Two things are worth seeing here. The table is now safe for any destination — old terminals, plain text logs, emails. And the usage bar becomes text: [........], a bracket of dots whose filled portion grows with use, the one form of the bar that survives every pipe intact.

Themes and thresholds: measured codes, documented colours

Duf has three themes — dark (the default), light, and ansi — chosen with --theme, and two threshold pairs that decide when colours change, set with --usage-threshold (defaults 0.5,0.9: the bar turns yellow past half full, red past nine tenths) and --avail-threshold (defaults 10G,1G: the AVAIL column warns as the remaining space falls through those sizes). Changing the thresholds changes no numbers — the lab's captures with --usage-threshold 0.1,0.2 print identical figures — only the point where green gives way.

What the lab could verify about colour itself, it did: run under a real terminal (a pseudo-terminal, via script), duf asks the terminal for its background colour before drawing, and wraps the usage bar in colour codes — the captured bytes are in transcript t09. But the capture terminal never answered the background question, so in every lab capture, under all three themes, the colour sequence around the bar came out empty: the machinery present, the colour unresolved. Which is to say: the colours and the differences between themes are documented-only in this guide — described from the project's own help and documentation, not graded from a screen the lab never saw. On your own terminal they will simply be there; the thresholds above are how you tune them.