Note: This is an RHCSA 7 exam objective.

The man pages

To get some information about a command (here ps), type:

# man ps

Sometimes several man pages exist for a command (here ps), to list them, type:

# whatis ps
ps (1) - report a snapshot of the current processes
ps (1p) - report process status

If you are not sure about the command name and want to search for a string (here ps), type:

# apropos ps
capsh (1) - capability shell wrapper
...
getpt (3) - open the pseudo-terminal master (PTM)

Each time a new package is installed, the associated man pages are added but the index database is not directly updated. This task is executed by cron once a day (see the /etc/cron.daily/man-db.cron file).

If you want to update this index database used by the whatis and apropos commands without waiting for the cron update, type:

# mandb

Note: The makewhatis command available in RHEL 4/5/6 has been replaced with the mandb command.

The info command

Also, some commands (here ipc) offer additional documentation that you can get as follows:

# info ipc

To get the list of these commands, type:

# ls /usr/share/info
accounting.info.gz    gawk.info.gz        libc.info-10.gz  make.info-2.gz
as.info.gz            gccgo.info.gz       libc.info-11.gz  make.info.gz
bash.info.gz          gcc.info.gz         libc.info-12.gz  nano.info.gz
bc.info.gz            gccinstall.info.gz  libc.info-13.gz  nettle.info.gz
binutils.info.gz      gccint.info.gz      libc.info-14.gz  parted.info.gz
chrony.info.gz        gettext.info.gz     libc.info-1.gz   pinentry.info.gz
configure.info.gz     gnupg.info-1.gz     libc.info-2.gz   pinfo.info.gz
coreutils.info.gz     gnupg.info-2.gz     libc.info-3.gz   rluserman.info.gz
cpio.info.gz          gnupg.info.gz       libc.info-4.gz   sed.info.gz
cpp.info.gz           gprof.info.gz       libc.info-5.gz   standards.info.gz
cppinternals.info.gz  grep.info.gz        libc.info-6.gz   tar.info-1.gz
dc.info.gz            grub2-dev.info.gz   libc.info-7.gz   tar.info-2.gz
diffutils.info.gz     grub2.info.gz       libc.info-8.gz   tar.info.gz
dir                   gzip.info.gz        libc.info-9.gz   time.info.gz
ed.info.gz            history.info.gz     libc.info.gz     wget.info.gz
find.info.gz          info.info.gz        libgomp.info.gz  which.info.gz
find-maint.info.gz    info-stnd.info.gz   libidn.info.gz
gawkinet.info.gz      ld.info.gz          make.info-1.gz

The locate command

In addition, the locate command provides results similar to the find / -name command and uses a dedicated index database called mlocate.db. This database is updated by cron once a day (see the /etc/cron.daily/mlocate file).

To search for a specific file (here sysctl.conf), type:

# locate sysctl.conf
/etc/sysctl.conf
/etc/sysctl.d/99-sysctl.conf
/usr/share/man/man5/sysctl.conf.5.gz

To update the mlocate.db index database without waiting for the cron update, type:

# updatedb

The packages documentation

Also, don’t forget how to find the package name providing a specific command (here mandb):

# yum whatprovides */mandb
...
man-db-2.6.3-9.el7.x86_64 : Tools for searching and reading man pages
Repo        : @anaconda
Matched from:
Filename    : /usr/bin/mandb

Note: The search is not only local but also in all the remote, currently configured repositories.

And, to search for a string (here sysctl.conf) in a package (here initscripts), type:

# rpm -ql initscripts | grep sysctl.conf
/etc/sysctl.conf
/etc/sysctl.d/99-sysctl.conf

Note1: The use of the locate command should be quicker. Note2: Use the -qpl option with the complete path, if the package hasn’t still been installed.

Finally, most packages come with their own documentation in the /usr/share/doc directory.

Note: Most of the SELinux documentation is not installed by default any more, you need to install it yourself. Hopefully, you can follow the tutorial about deploying SELinux man pages.

You can also get the various man pages and documentation available for a given package (here less):

# rpm -qd less
/usr/share/doc/less-458/LICENSE
/usr/share/man/man1/less.1.gz
/usr/share/man/man1/lessecho.1.gz
/usr/share/man/man1/lesskey.1.gz

Additional useful commands

Also, various commands can provide some help.

The which command gives you the system path associated with a command by relying on your PATH environment variable.

# which mandb
/usr/bin/mandb

The whereis command displays the system path of a command, the associated man page file and other files with this name known by the system. It relies on your PATH and MANPATH environment variables but not only.

# whereis httpd
httpd: /usr/sbin/httpd /usr/lib64/httpd /etc/httpd /usr/share/httpd /usr/share/man/man8/httpd.8.gz