Cat Pages — Faster Man Pages

Use “catman” to Speed Up Your Man Pages

Sebastian Carlos
3 min readApr 15, 2023
Photo by Miikka Luotio on Unsplash

An updated version of this story is available here.

Did you know that man pages, the documentation files on UNIX systems, are written in a markup language from the 70’s called “roff”?

Every time you run the man command, the source files are converted into plain text (adjusted to the width of your terminal.)

“roff” source file converted to output to display on your terminal.

When using modern man implementations like “man-db”, it’s possible to store the formatted manual pages on disk so that future requests do not have to be formatted again.

These pre-formatted man pages are known as “cat pages.”

Although cat pages require some megabytes of disk space, they substantially increase speed. Indeed, cat pages might load two or three times faster!

man pages (top, average of 185ms) vs cat pages (bottom, average of 53ms) — Benchmark done with hyperfine.

The increase in computer performance since the 90s has considerably reduced the need for cat pages, so you probably won’t even notice the milliseconds of speed improvement. But it’s worthwhile if you want to squeeze every bit of performance out of your system.

The hierarchy of cat pages is created in a separate folder from the hierarchy of man pages — It mirrors the folders and file names of the man hierarchy. In short, it’s a cache.

The hierarchy of man page folders, next to the hierarchy of cat page folders, in a typical installation of man-db.

Whether or not cat pages are created on your system depends on several factors, not least how man-db was installed. So make sure to read its manual (man-db-manual.{ps/txt}), its configuration file (/etc/man_db.conf), and — naturally — the man page for man.

You will find that in most systems, by default, cat pages are created only if you try to run man with a column width set to 80 (easily done with the env variable MANWIDTH=80), which after all is a beautiful looking default for any screen size!

You might also need to manually run the commands mandb and catman, usually as root, to create the cat pages hierarchy for all your man pages.

You can verify if there is a cat page for a given man page by running man -W ls. That is, with the flag -W (also --where-cat or --location-cat.) It should print the location of the cat page for the ls command. It’s purrtastic!

Thanks for reading! If you enjoy humorous tech stories like these and want to support me to keep writing forever, consider signing up to become a Medium member. It’s $5 a month, giving you unlimited access to stories on Medium. If you sign up using my link, I’ll earn a small commission. You can also follow me on Medium and Twitter.

--

--