Ubuntu – How to find out where $MANPATH is set

bashenvironment-variablesmanpagezsh

How can I find out in which configuration file the environment variable $MANPATH is set? Is there a way to backtrace the values?

I am aware of that I can grep through the whole file system using find or grep. I am using zsh most of the time instead of bash. I run Ubuntu Precise.

Best Answer

As others already wrote Ubuntu doesn't set the MANPATH by default. You can edit your .profile and add the MANPATH as you like. But where does Ubuntu get the information about your manpath?

This information is set in /etc/manpath.config. The package man-db uses this information to configure the paths for man. The environment variable MANPATH has precedence over the file manpath.config. The file has the following (and probably more) entries:

MANDATORY_MANPATH /usr/share/man
MANPATH_MAP /usr/bin /usr/man
DEFINE troff groff -mandoc

The first line tells a software which automatically generates the MANPATH what directories it should contain. Typically /usr/man, /usr/share/man and other are set up here.

Next is a mapping from the users PATH to the correct MANPATH. If a user has /usr/bin in his PATH, the MANPATH should contain /usr/man in my above example.

The DEFINE value has some default set of arguments and programs for pager utilities.