LinuxCommandLibrary

manpath

Display manual page search path

TLDR

Display the search path used to find man pages

$ manpath
copy

Show the entire global manpath
$ manpath [[-g|--global]]
copy

SYNOPSIS

manpath [OPTION]...

PARAMETERS

-q, --quiet
    Suppress output to standard output. The command will only return an exit status indicating success or failure. This is useful for scripting.

-d, --debug
    Print verbose debugging messages to standard error, providing insight into how the search path is being determined and processed.

-g, --global
    Output the system-wide default MANPATH as determined by the system's configuration files (e.g., manpath.config), ignoring any user-set MANPATH environment variable.

-c, --clear
    Clear the internally built MANPATH and start from an empty path before adding any new paths. This option is often used internally by the man command for building a path from scratch.

-h, --help
    Display a brief help message describing the command's options and usage, then exit.

-V, --version
    Display version information for the manpath utility and then exit.

DESCRIPTION

The manpath command is a utility used to display and sometimes control the search path for manual pages. It outputs the directories that the man command searches when looking for documentation. This path is typically defined by the MANPATH environment variable.

When invoked without any options, manpath usually prints the current effective MANPATH. This is useful for debugging issues where man cannot find a specific manual page, as it helps identify which directories are being searched and in what order. While manpath itself doesn't directly modify the shell's environment, it provides the path string that can be used to set the MANPATH variable in a shell script or configuration file.

CAVEATS

The manpath command primarily displays the effective MANPATH based on system defaults, user configuration, and the MANPATH environment variable. However, it does not directly modify the shell's environment. To permanently change the MANPATH for your session or future sessions, you must set the MANPATH environment variable using commands like export MANPATH=/your/path in your shell's startup files (e.g., .bashrc, .profile).

ENVIRONMENT VARIABLES

The primary environment variable affecting manpath (and thus man) is MANPATH. If MANPATH is set, manpath will generally display its value, potentially augmented by system defaults. If MANPATH is unset, manpath will determine a default path based on system configuration and the user's PATH environment variable.

CONFIGURATION FILES

Default MANPATH settings are often defined in system-wide configuration files, typically located at /etc/manpath.config or similar paths. These files specify the default directories to search for manual pages and can include architecture-specific or locale-specific paths.

HISTORY

The manpath command is part of the man-db package, which is a popular implementation of the Unix man system on Linux and other Unix-like operating systems. It was developed to provide a more robust and efficient way to manage manual pages, including their indexing and searching. Its role has always been to help administrators and users understand how man locates its documentation, making it a key diagnostic tool in the manual page ecosystem.

SEE ALSO

man(1), man.conf(5), manpath.config(5), mandb(8)

Copied to clipboard