In Ubuntu, when I run the command man rsyslog.conf
, a manual page comes up. So I tried to find the location of this man page by whereis -m rsyslog.conf
, but it didn't give me any results. Should I use another command for $config mans' locations? Where are these man pages stored in Linux?
2 Answers
You can ask man
where it's finding the man page.
$ man -w rsyslog.conf
/usr/share/man/man5/rsyslog.conf.5.gz
The whereis
utility does know to look there:
$ whereis -m xfs.5
xfs: /usr/share/man/man5/xfs.5.gz
So why doesn't it find rsyslog.conf
?
$ whereis -m rsyslog.conf
rsyslog:
The fact that the line begins with rsyslog:
and not rsyslog.conf:
is a hint. It's because whereis
ignores the extension of what you ask it to find.
$ whereis -m xfs.1
xfs: /usr/share/man/man5/xfs.5.gz
And when whereis
is looking at available files, it ignores compression extensions, and allows the actual file to have one extra extension (plus a few other things that aren't relevant here). So when it's told to look for xfs.5
, it actually looks for xfs
, but allows xfs.5.gz
as a match (it would also allow xfs
, xfs.42
, xfs.gz
, etc.). When it's told to look for rsyslog.conf
, it actually looks for rsyslog
, and it would allow rsyslog.conf.gz
or rsyslog.5.gz
but not rsyslog.conf.5.gz
. If you told it to look for rsyslog.conf.5
, it would find the man page (but it would even find a man page in another section).
While whereis
conveniently groups looking for executables, manual pages and source code in one place, it's less reliable than other tools because it has quirky lookup rules and only looks in hard-coded places.
- To look for an executable in your current executable search path (
$PATH
), use thetype
shell builtin. - To look for a man page in your current man page search path (
$MANPATH
or deduced from$PATH
plus a system configuration), useman -w
(orman -wa
in case there are multiple matches). - To look for a file anywhere on the system, use
locate
. - To look for a file in an Ubuntu package even if you haven't installed that package, use
apt-file search
.
In Ubuntu, dpkg -L <package>
will tell you all files shipped with this package. If you don't find the man pages in there, then you can often find it in <package>-doc
For rsyslog
:
$ dpkg -L rsyslog | grep man
/usr/lib/x86_64-linux-gnu/rsyslog/mmanon.so
/usr/share/man
/usr/share/man/man1
/usr/share/man/man5
/usr/share/man/man5/rsyslog.conf.5.gz
/usr/share/man/man8
/usr/share/man/man8/rsyslogd.8.gz
You can look at the raw *.gz
with:
$ gunzip -c /usr/share/man/man5/rsyslog.conf.5.gz
.TH RSYSLOG.CONF 5 "22 October 2012" "Version 7.2.0" "Linux System Administration"
.SH NAME
rsyslog.conf \- rsyslogd(8) configuration file
.SH DESCRIPTION
The
.I rsyslog.conf
file is the main configuration file for the
.BR rsyslogd (8)
which logs system messages on *nix systems. This file specifies rules
for logging. For special features see the
.BR rsyslogd (8)
manpage. Rsyslog.conf is backward-compatible with sysklogd's syslog.conf file. So if you migrate
from sysklogd you can rename it and it should work.
...
To answer your more general question "Where are manual locations for configurations", these are in chapter 5 (/usr/share/man/man5/
). If we look at the output of man man
(don't google that), we get:
The table below shows the section numbers of the manual followed by the types of pages they contain.
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, e.g. /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]