Inspect the Installed man-db Index with accessdb
You will use accessdb to read the local man-db index as human-readable text, check which database the installed command is using, and diagnose a bad path without changing man-db data. Allow about ten minutes. You need a shell and a readable man-db installation; the normal workflow does not require elevated privileges.
The route
Jump straight to the step you need, or tick off Done means at the end.
The examples were checked with man-db 2.12.0-4build2, whose command reports accessdb 2.12.0. Output is host-specific: it contains the manual names, paths and metadata known to this machine, so treat it as local diagnostic data rather than something to paste into a public bug report unchanged.
1. Check the installed command
Confirm the executable and package version before relying on output in a script or support note. These are ordinary read-only commands:
$ command -v accessdb
/usr/sbin/accessdb
$ dpkg-query -W -f='${Package} ${Version}\n' man-db
man-db 2.12.0-4build2
$ accessdb --version
accessdb 2.12.0
Your package revision may differ even when the upstream accessdb version is the same. Keep both values when a version-specific investigation matters.
Checkpoint: if command -v finds nothing, stop here and install or repair man-db through your normal package-management process. Do not copy a binary from another host merely to make the example run.
2. Read the default database
Run the command without an index-file argument:
$ accessdb | head -12
"io::socket::ip" -> ""IO::Socket::IP" 3perl 3 1789408206 0 C IO::Socket::IP - gz "
"socket" -> ""Socket" 3perl 3 1789408206 0 C Socket - gz "
$home/.odbc.ini -> "$HOME/.odbc.ini 5 5 1717421016 0 C odbc.ini - gz "
$version$ -> "2.5.0"
The pipe limits what is displayed; it does not make accessdb understand a query or filter the database. Each line represents an indexed name and associated manual metadata. The exact ordering, timestamps and entries depend on the host's installed manuals and cache.
In the installed 2.12.0 build, accessdb --help says the default is /var/cache/man/index.db. The manual page describes the more general /var/cache/man/index.<db-type> form, because the suffix depends on the database library in use. Trust the installed command's help when these descriptions appear more specific on your system.
Checkpoint: verify the file that was actually used:
$ ls -l /var/cache/man/index.db
-rw-r--r-- 1 man man 1777664 Sep 22 06:15 /var/cache/man/index.db
The size, owner and timestamp will differ. The useful check is that the path exists and is readable. No service is restarted and no cache is rebuilt by this command.
3. Inspect a specific index file
The optional positional argument overrides the default. Pass the complete path to an index file you have already identified:
$ accessdb /var/cache/man/index.db | head -3
"io::socket::ip" -> ""IO::Socket::IP" 3perl 3 1789408206 0 C IO::Socket::IP - gz "
"socket" -> ""Socket" 3perl 3 1789408206 0 C Socket - gz "
$home/.odbc.ini -> "$HOME/.odbc.ini 5 5 1717421016 0 C odbc.ini - gz "
This is useful when a host has more than one man-db cache, or when you are comparing a known index with the default. It is not a path to an individual manual page. Do not pass /usr/share/man/man8/accessdb.8.gz; that is compressed manual-page source, not a man-db index.
Quote a path when it comes from a variable or may contain spaces:
$ INDEX_FILE='/var/cache/man/index.db'
$ accessdb "$INDEX_FILE" | head -5
Keep the index path separate from shell options. Never place untrusted text into an option string or evaluate it as shell code. The command only reads the selected file, so there is no undo step for this inspection.
4. Use the built-in options for scripts and diagnostics
Use --help or --usage when you need the command contract without reading a database:
$ accessdb --usage
Usage: accessdb [OPTION...] [MAN DATABASE]
The installed command also supports --debug, --help, --usage and --version, with the short forms -d, -? and -V where documented. Use --debug only when ordinary output is insufficient, because diagnostic text can make it harder to spot database entries in a redirected file.
For a script, test the exit status rather than searching for a particular entry:
if accessdb "$INDEX_FILE" >/tmp/accessdb-check.txt; then
printf '%s\n' 'man-db index readable'
else
status=$?
printf 'accessdb failed with status %s\n' "$status" >&2
exit "$status"
fi
The temporary output file is ordinary command output, not a database backup. Remove it after review with rm -- /tmp/accessdb-check.txt if it contains paths you do not want to retain. That deletion is optional and irreversible; do not run it until you have finished inspecting the file.
5. Diagnose an unreadable or wrong path
First check the path without changing permissions or ownership:
$ test -r "$INDEX_FILE" && echo readable || echo 'not readable'
readable
$ accessdb /tmp/accessdb-no-such-index-8
/usr/sbin/accessdb: can't open /tmp/accessdb-no-such-index-8 for reading: No such file or directory
$ printf 'exit status: %s\n' "$?"
exit status: 2
A missing file, a directory, a corrupt index and insufficient read permission are different problems. Read the complete error, record the exit status immediately, and confirm that the argument names the intended index. Do not solve a permission error by making /var/cache/man world-writable or changing ownership.
Most default-cache checks should work as the owning user because the installed index is normally readable. If an administrator has deliberately restricted a different index, ask for the appropriate access rather than using elevated privileges casually. If you are authorised to inspect it, run only the single read command with the required privilege and avoid redirecting sensitive output into a shared directory.
Done means
- The installed package and accessdb versions are recorded.
- The default index was read without changing the man-db cache.
- An explicit index path was checked when the default was not sufficient.
- Output was treated as local path and manual metadata, not as a safe public transcript.
- Failures were diagnosed from the exact path, error text and immediate exit status.