mandb
Create and update manual page databases for improved man page performance
Syntax
mandb [options] [directories]
Basic Usage
Update manual databases
mandb
Updates all manual page databases in the default locations.
Update specific directory
mandb /usr/local/man
Force complete rebuild
mandb -c
Common Options
-c, --create: Create new databases instead of updating existing ones-d, --debug: Enable debugging output-f, --force: Force update even if no changes detected-q, --quiet: Suppress warning messages-s, --system: Only process system manual pages-u, --update: Update existing databases (default behavior)-v, --verbose: Enable verbose output-w, --warning: Enable warning messages
Practical Examples
Update all manual databases
sudo mandb
Force complete rebuild of databases
sudo mandb -c
Update only system manual pages
sudo mandb -s
Update with verbose output
sudo mandb -v
Update specific manual directories
sudo mandb /usr/local/man /opt/man
Create new database for custom man pages
sudo mandb -c /home/user/man
Best Practices
When to Use
- After installing new software packages
- When man pages are not being found
- After updating existing packages
- When troubleshooting documentation issues
- After adding custom manual pages
Important Notes
- Run with sudo/root privileges for system-wide updates
- Complete rebuilds (-c) can take time on large systems
- Package managers typically run mandb automatically
- Use -f flag sparingly as it can be resource-intensive
- Check system logs if mandb fails to complete