RHEL7: Locate, read, and use system documentation including man, info, and files in /usr/share/doc.

Share this link

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

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

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

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

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
1 Star2 Stars3 Stars4 Stars5 Stars (8 votes, average: 4.13 out of 5)
5 comments on “RHEL7: Locate, read, and use system documentation including man, info, and files in /usr/share/doc.
  1. xpert123 says:

    Do we have a solutions for Task of the day exercises?

  2. twostep says:

    If you want to find the doc files for a given command (semanage for example):
    rpm -qd $(rpm -qf $(which semanage))

  3. hallo says:

    Surprised by the contents of info rluserman – cut & paste, undo, etc ?!?!?!

Leave a Reply

Upcoming Events (Local Time)

There are no events.

RHCSA7: Task of the day

Allowed time: 10 minutes.
Archive and compress the content of the /opt directory (create files if none exists).
Uncompress and unarchive the resulting file in /root

RHCE7: Task of the day

Allowed time: 8 minutes.
Set up an iScsi target based on a fileio backstore of 100MB called /opt/shareddata with CHAP authentication (username=usr/password=pwd), xfs filesystem and standard firewall configuration.

Follow me on Twitter

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...