LinuxCommandLibrary

mandb

Create or update the manual page index

TLDR

Purge and process manual pages

$ mandb
copy

Update a single entry
$ mandb --filename [path/to/file]
copy

Create entries from scratch instead of updating
$ mandb --create
copy

Only process user databases
$ mandb --user-db
copy

Do not purge obsolete entries
$ mandb --no-purge
copy

Check the validity of manual pages
$ mandb --test
copy

SYNOPSIS

mandb [-d|-t|-p|-q|-w|-c] [-f filename] [-C file] [-L locale] [-M path] [-S section-list] [manpath]

PARAMETERS

-d
    Debug mode. Emits copious debugging information.

-t
    Do not actually update any databases, but do everything else. This option is useful for testing the integrity of the manual page files and configuration.

-p
    Print the list of manual page directories that mandb will search, and then exit.

-q
    Be quiet. Only emit error messages.

-w
    Warn if any manual pages contain incorrect `man' macro usage.

-c
    Create a new database instead of updating an existing one.

-f filename
    Only process the given file. Useful for updating the database after modifying a single manual page.

-C file
    Use the given file as the man.conf configuration file instead of the default.

-L locale
    Update the database for the given locale.

-M path
    Specify an alternate manual page path to use instead of the system default. Multiple paths can be specified, separated by colons.

-S section-list
    Specify a list of manual page sections to process. Sections are separated by colons.

manpath
    Optional argument specifying the manual path to process.

DESCRIPTION

The mandb command is used to create or update the manual page index databases. These databases are essential for the man command to quickly locate and display relevant manual pages. mandb parses the manual pages in the standard manual page directories (and any specified via the command line), extracts indexing information, and stores it in a database format suitable for efficient searching by man.

It is usually run automatically by a system cron job to keep the database up to date. You can also run it manually to update the database after installing new software or changing your manual page configuration. If the manual database is not up to date, the `man` command may fail to find newly installed manual pages or return outdated results.

Running mandb requires root privileges to update the system-wide manual page index. However, ordinary users can update their own local manual page databases if the appropriate manual page directories are within their home directories. Multiple languages supported.

CAVEATS

mandb requires write access to the manual page database directories. System-wide updates require root privileges. Manual pages that do not conform to standard formatting conventions may not be indexed correctly.

EXIT STATUS

mandb returns 0 on success and non-zero on failure.

FILES

/etc/man.conf: The man configuration file.
/var/cache/man/index.(bt2|db): Traditional system-wide manual page index databases.

HISTORY

The mandb command is a relatively standard utility that has been around for many years, evolving alongside the broader man system. Its primary purpose has consistently been to improve the speed and accuracy of manual page searches. The specific implementation details and features have likely changed over time with different distributions, reflecting improvements in database technology and evolving user needs. It helps to provide faster and more organized access to system documentation.

SEE ALSO

man(1), manpath(1), apropos(1), whatis(1)

Copied to clipboard