How do I install a man page file system-wide?
For example, if I have a man page file
examplecommand.1, how do I install it so that I can just type
man examplecommand to view it?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
First, find out which section your man page belongs to. If its a command, it probably belongs to section
1. You can read the manpage for the
man command to see a description of the different sections and their corresponding numbers.
Copy your man page to
1 to your section number if need be). You can also install it to
/usr/share/man/man1/, but it's best practise to use the
local directory for files that are installed without using the APT package manager:
sudo cp examplecommand.1 /usr/local/share/man/man1/
mandb command. This will update
man's internal database:
That's it! You should be able to view the man page by running:
man 1 examplecommand
If you only need to install the man page locally :
MANPATH is unset, or includes an empty component (i.e. starts with
:, ends with
:, or contains
<path>/share/man will automatically be searched for man pages whenever
<path>/bin is part of
PATH, for all values of
This provides a very simple way to add man pages for locally installed software. There are some details in
man manpath and
/etc/manpath.config, but I don't see any mention of the generic mapping from
The answer by @ntc2 above is the one people should be looking at. I wanted to add some extra commentary which didn't fit in the comments section:
The approach by @ntc2 provides a path for people only needing to set their PATH (which they already expect) for local binaries.
However, I don't think the generic mapping
<path>/share/man exists for all paths in
$PATH. It seems like this specific mapping is avoided when the
$PATH in question is
$HOME/bin. When performing strace(1) on
MANPATH=:/nonexistingdir, I see the following lookups:
For any element in
$PATH that's not
I have no idea why it skips the others. This is on a Debian Buster system. It may be different on other systems.
For me, this means that the safest path to install man-pages is
<path>/man, as it's guaranteed to be found if it's in the