Manual pages: not just for the console anymore

Posted by JoshTriplett on Thu 26 Oct 2006 at 14:21

You probably know about man, and how to read manual pages in the console. But did you know that man can display manual pages many other ways, such as in a browser, or in a printer-friendly form?

Manual pages use a typesetting format called roff (specifically, the man macros) to include some semantic structure to a document. This structure defines paragraphs, lists, headings, and manual page metadata. For more information on this format, read man 7 man.

Debian uses a Free Software implementation of roff from the GNU project, called groff. The Debian base system includes the package man-db, which contains (among other things) the man binary. This package Depends on the groff-base package, which includes some minimal functionality for rendering manual pages in a terminal, as formatted text. However, if you install the groff package (suggested by man-db), you get many additional output formats from man.

You can format a manual page as HTML by using the -Thtml option to man. By default, this will output the HTML-formatted manual page on standard output. As a shortcut, you can use man -H to format the manual page as HTML and open it in a web browser.

For easy printing, you can output a manual page as PostScript with -Tps. Again, this will output the PostScript-formatted manual page on standard output. You can capture it in a file, use a PostScript viewer which can view standard input, or pipe it straight to lpr to print it.


This article can be found online at the Debian Administration website at the following bookmarkable URL (along with associated comments):

This article is copyright 2006 JoshTriplett - please ask for permission to republish or translate.