Random Musings

Sporadic thoughts on tech, economics, business, finance and trading

Which commands in Linux rely on databases such as man pages – mandb, locate – updatedb, etc

,

Linux has several commands that rely on underlying databases to store and retrieve information quickly. Here are some of the key commands and the databases they depend on:

  1. man (manual pages):
    • Databasemandb
    • Details: The mandb utility creates an index of man pages, which allows faster searching and lookup when using the man command. mandb updates the manual page index in /var/cache/man or similar locations depending on the system.
  2. locate:
    • Databasemlocate.db
    • Detailslocate is used to quickly find files on the filesystem by name. It relies on the mlocate.db database, which is updated periodically by the updatedb command. The database is usually stored in /var/lib/mlocate/mlocate.db and allows fast searching by storing paths for all indexed files.
  3. whatis and apropos:
    • Databasewhatis and apropos use databases created by mandb.
    • Details: These commands search for man pages by keywords (e.g., apropos) or by providing a quick summary (e.g., whatis). They rely on the same index as the man command, created by mandb, to find matching entries.
  4. updatedb:
    • Databasemlocate.db
    • Detailsupdatedb is responsible for updating the mlocate.db database used by locate. It’s typically run as a scheduled task (cron job) to ensure the database stays current.
  5. info:
    • Databasedir (stored in /usr/share/info/dir)
    • Details: The info command displays more detailed GNU documentation, often supplementing man pages. It relies on an index file (dir) within the /usr/share/info directory, which helps navigate the various info documents.
  6. slocate (older alternative to locate):
    • Databaseslocate.db
    • Details: Similar to mlocateslocate builds a database of filenames and locations. It was replaced by mlocate in many distributions but still serves the same purpose in systems where it’s used.

These databases enable quick and efficient data retrieval, saving time compared to real-time file searching. They’re regularly updated, often through system cron jobs, to maintain accurate information for commands that rely on them.