File: man-path.rst

package info (click to toggle)
modules 5.6.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 23,036 kB
  • sloc: exp: 79,659; sh: 6,142; tcl: 5,900; makefile: 1,493; ansic: 474; python: 265; csh: 202; perl: 47; ruby: 44; lisp: 13
file content (80 lines) | stat: -rw-r--r-- 2,888 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
.. _man-path:

Handle man pages search path
============================

Man pages (manual pages), read with :command:`man` command, are stored in a
structured directory hierarchy under predefined locations. They are typically
stored within ``/usr/share/man`` and software-specific *man* directories.

:command:`man` searches for man pages the following way:

* if :envvar:`MANPATH` environment variable is set, man pages are only
  searched in the directories specified in it
* if :envvar:`MANPATH` is not set, :command:`man` determines the hierarchy
  search path using information gained from the ``man-db`` configuration

See `SEARCH PATH section`_ of ``manpath(5)`` man page to learn how ``man-db``
computes the default search path.

.. _SEARCH PATH section: https://man7.org/linux/man-pages/man5/manpath.5.html#SEARCH_PATH

The :command:`manpath` command can be used to observe the currently active
search path:

.. parsed-literal::

    :ps:`$` manpath
    /usr/local/share/man:/usr/share/man
    :ps:`$` export MANPATH=/usr/share/man
    :ps:`$` manpath
    manpath: warning: $MANPATH set, ignoring /etc/man_db.conf
    /usr/share/man

Systems usually do not define :envvar:`MANPATH` by default and rely on
``man-db`` configuration. On such systems, if a modulefile adds a specific
man page directory to :envvar:`MANPATH`, :command:`man` will not be able to
find system regular man pages anymore.

.. parsed-literal::

    :ps:`$` man --where ls
    /usr/share/man/man1/ls.1.gz
    :ps:`$` module show foo/1.0
    -------------------------------------------------------------------
    :sgrhi:`/path/to/modulefiles/foo/1.0`:

    :sgrcm:`append-path`     PATH /path/to/foo-1.0/bin
    :sgrcm:`append-path`     MANPATH /path/to/foo-1.0/man
    -------------------------------------------------------------------
    :ps:`$` module load foo/1.0
    :ps:`$` man --where ls
    No manual entry for ls

To retain access to the system man pages when modulefiles modify the
:envvar:`MANPATH`, the default search paths must be added into
:envvar:`MANPATH`. This can be done by appending a colon (``:``) to the end of
the :envvar:`MANPATH` value, which instructs the system to include its default
man page directories.

.. parsed-literal::

    :ps:`$` manpath
    manpath: warning: $MANPATH set, ignoring /etc/man_db.conf
    /path/to/foo-1.0/man
    :ps:`$` man --where ls
    No manual entry for ls
    :ps:`$` module append-path MANPATH :
    :ps:`$` man --where ls
    /usr/share/man/man1/ls.1.gz

If your modulefiles modify :envvar:`MANPATH`, it is recommended to initialize
this environment variable with a single colon (``:``) during Modules startup.
To do this, add the following line to the ``initrc`` configuration file
(typically located in ``/etc/environment-modules``):

.. code-block:: tcl

   append-path MANPATH :

.. vim:set tabstop=2 shiftwidth=2 expandtab autoindent: