I have added extra directories to $PATH
by exporting PATH=/my/dirs:$PATH
But I am not sure if I should do the same to MANPATH
. Because default MANPATH
is empty yet man
command works. I found a command called manpath
and its manual says If $MANPATH is set, manpath will simply display its contents and issue a warning.
. Does this mean setting MANPATH is not the right way to add directories for man
command to search for manual pages?
Command-Line – How to Set MANPATH Without Overriding Defaults
command line
Best Answer
If you simply set MANPATH, it overrides the default and you lose access to the standard man pages. For example,
man ls
works before setting MANPATH, but does not work afterwards.To append a search directory without overriding the default, prefix a colon to MANPATH like this:
Adding the colon gives you access to both the standard system man pages and the custom pages referenced in the MANPATH variable.
This answer brought to you by manpath(1):