Search code examples
bashshellshmanpage

How do I open a manual file not located in the man directory?


I would like to open a file myscript.1.gz that is not located at /usr/share/man/man1.


Solution

  • Use the -l (--local-file) option:

    man -l myscript.1.gz
    

    From man man:

    -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.