The UNIX Manual
On November 3, 1971, the first version of the Unix Programmer’s Manual was released, commonly known as man pages.
You can download it as PDF or PostScript from Dennis Ritchie’s page at Bell Labs, maintained by Nokia for historical reasons.
It’s interesting how UNIX commands haven’t changed much over the years. If you’re a Linux or BSD user, you’ll certainly recognize most of them. It’s also remarkable how such a simple idea can be so incredibly useful.
Pager
The man command uses a pager to display manpages, usually more or less. You can replace your system’s default pager by changing the PAGER environment variable, as shown below.
export PAGER="less"
Adding Color to Manpages
On many modern systems, less is the pager. We can configure it to display colors and highlight titles, words, parameters, lists, and so on, making the text more readable.
To add color to manpages, first make sure you’re using less as your pager. Then add the following variables.
export LESS_TERMCAP_mb=$'\e[1;32m'
export LESS_TERMCAP_md=$'\e[1;32m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;4;31m'
Try opening a manpage. Several parts of the text will be colored. You can play with ANSI codes to customize your colors.
Listing the Files
Several programs, like Python, install their own manpages. To list the files, use the man -w command.
man -w
man will show the path where it’s looking for manpages.
Exporting Manpages to HTML
Besides man, another very useful utility is mandoc, which you can use to export manpages to other formats, such as HTML.
mandoc -Thtml -Ostyle=style.css > foo.1.html
A Bit of mandoc History
mandoc first appeared in OpenBSD 4.8, released in November 2010. It’s fairly recent compared to other UNIX utilities.