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.
As others already wrote Ubuntu doesn't set the
MANPATH
by default. You can edit your.profile
and add theMANPATH
as you like. But where does Ubuntu get the information about your manpath?This information is set in
/etc/manpath.config
. The packageman-db
uses this information to configure the paths for man. The environment variableMANPATH
has precedence over the filemanpath.config
. The file has the following (and probably more) entries: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 correctMANPATH
. If a user has/usr/bin
in hisPATH
, theMANPATH
should contain/usr/man
in my above example.The
DEFINE
value has some default set of arguments and programs for pager utilities.Ubuntu by default doesn't set
$MANPATH
, so your search can be limited to your~/.{ba,z}shrc
and the files they includeThe search path compiled into the man command can be seen with
man -w
. On my system (12.10), this returns/usr/local/man:/usr/local/share/man:/usr/share/man
Try running
After running this command, the file
shell-startup-output
should show you each file being sourced when the shell starts. You can then examine each of these files to see which one sets$MANPATH$
.If this doesn't work for you, the only other way I know to do it is to use
grep
orfind
.