5

I often find myself in the situation where I need to look up the syntax and logic for a configuration file of some program on my computer. While I can do man mosquitto, this will not necessarily yield the help section for the file /etc/mosquitto.conf.

What I am searching for is something like man /etc/mosquitto.conf or man ./mosquitto.conf, which should open the exact help I need for a given file. Not just mosquitto, that was only an example.

Is there such a mapping somewhere? Is there a program that I can use to find help about specific configuration files, instead of having to search the internet?

0

3 Answers 3

9

Man pages come in different sections.

From a RedHat (Centos/Rocky) based system

       1   Executable programs or shell commands
       2   System calls (functions provided by the kernel)
       3   Library calls (functions within program libraries)
       4   Special files (usually found in /dev)
       5   File formats and conventions eg /etc/passwd
       6   Games
       7   Miscellaneous  (including  macro  packages  and  conventions), e.g.
           man(7), groff(7)
       8   System administration commands (usually only for root)
       9   Kernel routines [Non standard]

So in theory, a manpage for mosquitto.conf should be in section 5. And, indeed, man 5 mosquitto.conf did provide details.

However, this requires the package to provide the man page. Well documented apps do this (eg man sshd_config will return the section 5 manual page).

But it's totally up to the package and application to provide this information.

Not every config file will have a manpage associated with it.

5

TL/DR: There's no centralized repository of information. Most up-to-date source of information of a an application / tool / etc. is in its documentation. Otherwise there are man pages, info pages, tldr pages, html documentation, literature, internet...


Man pages are just one form of software documentation. The fastest way to find out whether a man page exists is just giving command man foo. Command apropos foo outputs a list of man pages containing info about foo.

man7.org hosts The Linux man-pages project, a web repository of man pages. It contains lists of man pages by section, alphabetically and by project. Man pages are viewed on the terminal by just man foo (for example man hosts), never man /path/foo or man ./foo (for example man /etc/hosts). Distributions can also host their own man pages online.

Not everything has a man page. There's no man page for .bashrc, but some information about it is found in man bash - not specifics on its contents, tho'. xattr has a man page, xattr.conf doesn't; man xattr.conf outputs No manual entry for xattr.conf. Xattr's man page doesn't mention the conf file either. Some info about it can be seen just by cat /etc/xattr.conf:

# Format:
# <pattern> <action>
#
# Actions:
#   permissions - copy when trying to preserve permissions.
#   skip - do not copy.

Other files like .bashrc also contain documentation in the form of comments.

Similar projects to man pages are GNU Info and TLDR. While man pages contain references to other man pages, they're static; so following references requires opening another page. GNU Info has internal hyperlinks. TLDR pages are sort of cheatsheets, a community effort to simplify the man pages. It also provides practical examples. They're used just like man - i.e. info xattr and tldr xattr.

GUI applications (GNOME and KDE, for example) don't use any of the above. Their end user documentation is provided using HTML, and they can contain viewers like GNOME's Yelp.

In the end providing documentation is entirely up to the developers. They can freely choose in which form they provide it - or not to provide it at all. There's a great many of them. Consequently the quality and availability of specific information varies a lot, and creating a single repository is simply impossible. Today the fastest and easiest way to find info is the internet.

7
  • I am asking for a general solution. How do I find help for "/etc/hosts" or "/etc/xattr.conf"?
    – Daniel D.
    Commented Feb 19, 2023 at 1:53
  • 2
    @DanielD. man hosts ... man xattr
    – jsotola
    Commented Feb 19, 2023 at 1:57
  • Are you saying that that always works and opens the section about the configuration file?
    – Daniel D.
    Commented Feb 19, 2023 at 2:16
  • 3
    @DanielD.Just like every other reference guide in existence you have to actually read enough to find the appropriate section. For example, if you want to know what hardware Linux runs on and you go to the Wikipedia page on Linux, should the specific section you need be automatically displayed?
    – doneal24
    Commented Feb 19, 2023 at 2:57
  • @DanielD - I updated my answer. Commented Feb 19, 2023 at 3:52
3

Unfortunately, not all programs organise their man pages the same way. In your example, check the "see also" section at end; you may find there things like mosquitto.conf(7) or mosquittod(8) meaning you can do man 7 mosquitto.conf or man 8 mosquittod.

Formats of files in /etc/ should be in manual category 5. Often it's the name of the main file, here man 5 mosquitto.conf (or man 5 sshd_config for /etc/ssh/sshd_config.) Sometimes it may be the name of the program (for example, man 5 passwd apply to /etc/master.passwd too) or something else.

You may try the apropos or the whatis to query the man pages index. Here, apropos mosquitto.conf

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .