How do I directly display a man page?

man has an option to read a local file: -l

-l, --local-file

Activate `local' mode. Format and display local manual files instead of searching through the system's manual collection. Each manual page argument will be interpreted as an nroff source file in the correct format. No cat file is produced.

If '-' is listed as one of the arguments, input will be taken from stdin. When this option is not used, and man fails to find the page required, before displaying the error message, it attempts to act as if this option was supplied, using the name as a filename and looking for an exact match.

So you can preview your work in progress with:

man -l /path/to/manfile.1


The 'old school' way, for systems that pre-date the -l option, is

nroff -man filename | more -s

I've used simply

man ./path/to/man.1

You need to include a slash in the path, otherwise it searches the system directories. Works on the Linux and OS X systems I have (the latter doesn't have -l).

$ cd /tmp
$ cp /usr/share/man/man1/ls.1 .
$ man ls.1
No manual entry for ls.1
$ man ./ls.1     # works

Tags:

Man