MANDOC.DB(5)
β¨ NAME β¨
mandoc.db β the manual page database π (yes bestie, it's literally a whole database, section 5, File Formats Manual energy)
πΈ DESCRIPTION πΈ
okay so picture this: the mandoc.db file format exists to store info about all your installed manual pages so you can do semantic searching for manuals instead of grepping around like it's 1999. every single manual page tree gets its own little mandoc.db bestie β peep the "FILES" section for examples π«Ά
these database files are generated by makewhatis(8) and used by man(1), apropos(1) and whatis(1). the girlies are all connected, no cap.
the file format uses three datatypes, and they are:
- 32-bit signed integer numbers in big endian (network) byte ordering
- NUL-terminated strings
- lists of NUL-terminated strings, terminated by a second NUL character
numbers are aligned to four-byte boundaries π and when they follow strings or lists of strings, padding with additional NUL characters occurs. some β but not all β numbers point to positions in the file. these pointers are measured in bytes, and the first byte of the file is considered to be byte 0. periodt.
each file consists of:
- One magic number,
0x3a7d0cdb. - One version number, currently
1. - One pointer to the macros table.
- One pointer to the final magic number.
- The pages table (variable length).
- The macros table (variable length).
- The magic number once again,
0x3a7d0cdb.
the pages table contains one entry for each physical manual page file, no matter how many hard and soft links it may have in the file system. it's giving "one page, infinite identities" π The pages table consists of:
- The number of pages in the database.
- For each page:
- One pointer to the list of names.
- One pointer to the list of sections.
- One pointer to the list of architectures or
0if the page is machine-independent. - One pointer to the one-line description string.
- One pointer to the list of filenames.
- For each page, the list of names. Each name is preceded by a single byte indicating the sources of the name. The meaning of the bits is:
0x10: The name appears in a filename.0x08: The name appears in a header line, i.e. in a.Dtor.THmacro.0x04: The name is the first one in the title line, i.e. it appears in the first.Nmmacro in the NAME section.0x02: The name appears in any.Nmmacro in the NAME section.0x01: The name appears in an.Nmblock in the SYNOPSIS section.
- For each page, the list of sections. Each section is given as a string, not as a number.
- For each architecture-dependent page, the list of architectures.
- For each page, the one-line description string taken from the
.Ndmacro. - For each page, the list of filenames relative to the root of the respective manpath. This list includes hard links, soft links, and links simulated with
.soroff(7)requests. The first filename is preceded by a single byte having the following significance: - Zero to three NUL bytes for padding.
not me hyping up padding bytes but honestly? iconic behaviour. those little NUL besties are holding the whole alignment together π
the macros table consists of:
- The number of different macro keys, currently
36. The ordering of macros is defined in<mansearch.h>and the significance of the macro keys is documented inapropos(1). - For each macro key, one pointer to the respective macro table.
- For each macro key, the macro table (variable length).
each macro table consists of:
- The number of entries in the table.
- For each entry:
- One pointer to the value of the macro key. Each value is a string of text taken from some macro invocation.
- One pointer to the list of pages.
- For each entry, the value of the macro key.
- Zero to three NUL bytes for padding.
- For each entry, one or more pointers to pages in the pages table, pointing to the pointer to the list of names, followed by the number
0.
π FILES π
/usr/share/man/mandoc.dbβ the manual page database for the base system./usr/X11R6/man/mandoc.dbβ the same for theX(7)Window System./usr/local/man/mandoc.dbβ the same forpackages(7).
a program to dump mandoc.db files in a human-readable format suitable for diff(1) is provided in the directory /usr/src/regress/usr.bin/mandoc/db/dbm_dump/. yes queen, you can literally diff your databases π
π¦ SEE ALSO π¦
apropos(1), man(1), whatis(1), makewhatis(8)
π HISTORY π
a manual page database /usr/lib/whatis first appeared in 2BSD. the present format first appeared in OpenBSD 6.1. glow-up of the century fr fr β¨
π AUTHORS π
the original version of makewhatis(8) was written by Bill Joy in 1979. the present database format was designed by Ingo Schwarze <schwarze@openbsd.org> in 2016. legends only π
and that's the whole vibe bestie β this lil page is straight outta the Debian collection, dated August 1, 2016, MANDOC.DB(5) and everything. stay aligned to your four-byte boundaries, drink water, and go read a man page today π«Άπ
πΈ
π¦ where this page comes from
- alpine 3.22: mandoc-doc 1.14.6-r13 Β· ISC
- alpine 3.23: mandoc-doc 1.14.6-r14 Β· ISC
- alpine 3.24: mandoc-doc 1.14.6-r15 Β· ISC
- arch rolling: mandoc 1.14.6-5 Β· ISC
- debian trixie: mandoc 1.14.6-4 Β· ISC
- epel 10: mandoc 1.14.6-11.el10_1 Β· ISC AND BSD-2-Clause AND BSD-3-Clause
- epel 9: mandoc 1.14.6-2.el9 Β· ISC
- fedora 43: mandoc 1.14.6-12.fc43 Β· ISC AND BSD-2-Clause AND BSD-3-Clause
- fedora 44: mandoc 1.14.6-13.fc44 Β· ISC AND BSD-2-Clause AND BSD-3-Clause
- freebsd 15.1: base 15.1
- nixos 26.05: mandoc 1.14.6
- nixpkgs unstable: mandoc 1.14.6
- opensuse-leap 16.0: mandoc 1.14.6-160000.2.2 Β· ISC
- opensuse-leap 16.0: mandoc 1.14.6-160000.2.2 Β· ISC
- opensuse-leap 16.0: mandoc 1.14.6-160000.2.2 Β· ISC
- opensuse-leap 16.0: mandoc 1.14.6-160000.2.2 Β· ISC
- ubuntu questing: mandoc 1.14.6-4
- ubuntu resolute: mandoc 1.14.6-4build1 Β· ISC
- ubuntu stonking: mandoc 1.14.6-4build1 Β· ISC
- Copyright (c) 2014, 2016 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms