Lab 2a: System documentation
Task 1: Using and configuring man pages
Description
First, we start a separate terminal,
su to root and run the following command in the background (with the “&”). We will need it later on, but it might take a while to run depending on your system.
mandb -cqs &
From another terminal, run the following 2 commands:
man 1 passwd
man 5 passwd
Command
# mandb -cqs &
Screenshot
What is the difference between the two man 1 passwd & man 5 passwd?
man 1 passwd
PASSWD(1)
User utilities
The passwd utility is used to update user's authentication token(s).
man 5 passwd
PASSWD(5)
Linux Programmer's Manual
NAME
passwd - password file
DESCRIPTION
The /etc/passwd file is a text file that describes user login accounts for the system. It should have read permission allowed for all users (many utilities, like ls(1) use it to map user IDs to usernames), but write access only for the superuser.
Now run the command:
man passwd
Which one is shown (section 1 or section 5)?
Section 1 is shown
We look in the file /etc/man_db.conf. Look for the SECTION entry in the file to verify the above behaviour.
While we are in the file, we also look at the MANDATORY_MANPATH section, to see in which directories the man command will look for man pages by default.
mandatory_manpath section
Now we run the following two commands and compare them (you might like to run them in two separate terminals):
man grep
info grep
Comparing the info page to the man page (in general terms) we can see that they are quite different.
man grep
man grep #provides general commands manual for grep, egrep, fgrep
info grep
This manual is for version 3.1 of GNU Grep.
This manual is for ‘grep’, a pattern matching engine.
whatis passwd vs apropos passwd
Next we try the commands whatis passwd & apropos passwd:
Which one returns more results? Why?
whatis passwd returns less result comparing to apropos passwd. Becasues:
whatis
searches the manual page names and displays the manual page description of any name matched.
apropos
searches the descriptions for instances of keyword. keyword is usually a regular expression, as if (-r) was used, or may contain wildcards (-w), or match the exact keyword (-e). Using these options, it may be necessary to quote the keyword or escape (\) the special characters to stop the shell from interpreting them.
whatis passwd
apropos passwd
Task 2: Finding installed package documentation
Installed package documentation is in the directory /usr/share/doc/sed*/.
Task 3: Finding documentation on the Internet
www.tldp.org (The Linux Documentation Project) is a good place to start for up to date Linux documentation.
HOWTO document about the Linux Clock - https://tldp.org/HOWTO/Clock-2.html
The main Linux FAQ - https://tldp.org/FAQ/pdf/Linux-FAQ.pdf
Linux System Administrator’s Guide (or SAG for short) - https://tldp.org/LDP/sag/html/index.html