We could spend a good amount of time learning CentOS; it is equivalent to serving you cooked food, but in place of this, we could actually learn how to cook, so that you’ll be able to make your own different recipes. Linux has one of the best and largest bodies of documentation in the operating system for most of the commands and their options. Whether you are an experienced user or a beginner, you will never remember the exact use of all the Linux commands and utilities, each with its own multiple options. It is in this case that Linux documentation comes to our rescue.
Different types of documentation available in Linux
There are multiple sources of documentation available in Linux for learning how to use different commands and their options,as shown in the following diagram:
Using the man command
Man(short for manual)pages are the most used source of Linux documentation for various programs, utilities, system calls, library files, configurationfiles, and kernelsthat exist within the system. The wholemandocumentation is organized in nine sections,where each section caters for a particular type of documentation.By default, if there are multiple sections for one command, it displays the documentation from the first section it encounters. The syntax for man
command usage is as follows:
$ man <topic name>
Upon execution of the preceding command, the specified topic’s contents will be displayed on one screen at a time. Use the arrow keys for scrolling line by line, or press the Space bar for the next screen. By default, man pages are opened in the less viewer.
The following table lists the man pagenavigationcommand keys and their description:
Key
Description
Space bar/Page Down
Scroll down one screen
Page Up
Scroll up one screen
Down arrow (↓)
Scroll down a single line
Up arrow (↑)
Scroll up a single line
/string
Search forward (down) for the given string in the man page
?string
Search backward (up) for the given string in the man page
n
Repeat the previous search forward in the man page
N
Repeat the previous search backward in the man page
q
Exit the man and return to the prompt
g/Home
Go to the start of the man page
G/End
Go to the end of the man page
Some useful options that are used with the man
command include the following:
$ man -f <topic name>
: Gives a briefdescription of that topic (the equivalent of thewhatis
command). See the following screenshot for usage:
$ man -k <topic name>
: Lists all the matching pages that discuss a specified topic in their man pages (the equivalent ofapropos
).See the following screenshot for usage:
$ man -a <topic name>
: Displays, in sequence, all the man pageswith the given topic name from all sections.For example,man -a passwd
will listall the manpagescontainingpasswd
in any section.$ man <section number> <topic name>
: Forces theman
command to display topic documentation from a given section. Otherwise, by default, it displays the most popular section when used without a section number, as shown in the following command:
$ man passwd
Output on execution of the preceding command is shown in the following screenshot:
The man
command with a specified section lists the documentation from that particular section as shown in following command:
$ man 5 passwd
Output on execution of the preceding command is shown in the following screenshot:
Using the GNU info command
The next source of documentation inLinux is GNU info pages, where the topics are connected using hyperlinks. The documentation contained in info pages can be read through the command lineusinginfo
orpinfo
commands,or with the help of a graphical utility.Some commands and utilities have both info and man documentation, but info documentation will usually be more in-depth.
The topic viewed in the info page is known as a node. Eachnodecan include menus and subtopics known asitems. Item names are prefixed with an asterisk (*
) symbol.You can browse through the topic list using the regular keys (the arrow keys,Page Up andPage Down). The following table lists the most commonly used keys for navigation inside info pages:
Key
Description
Page Downor Space bar
Scroll forward one screen
Page Upor b
Scroll up one screen
n
Go to the next node
p
Go to the previous node
u
Move one node up in the index
Tab
Move to next hyperlink (node)
Enter
Select the node and display the content of the current cursor location
q
Quit viewing the info page
/string
Search for a string in the open document
/<EnterKey>
Repeat the previous search forward
Typing the info
command without any argument in Terminal displays an index of available topics as shown in following command:
$ info <topic name>
Output on execution of the preceding command is shown in the following screenshot:
Using the help command and the –help option
Thehelp
command is anotherimportantsource of documentation that exists in Linux. MostLinuxcommands have a short description that can be viewed using the--help
or the-h
option, along with the command or application name.
For example, you can learn more about the mkdir
command by running it with the --help
option, as shown in the following command:
$ mkdir --help
Output on execution of the preceding command is shown in the following screenshot:
The --help
option is quite handy as a quick reference, as it displays limited information for using various options associated with the given command. Executing the help
command on its own displays the list of built-in internal commands in Bash. You can also display the help info for these built-in commands by typing help
, followed by the internal command name, as shown in following command:
$ help exit
Output on execution of the preceding command is shown in the following screenshot:
Other sources of documentation
In addition toman
andpinfo
, page developers may also include documentation in the application’s RPM package. This documentation is installed on package installation and is conventionally stored in the /usr/share/doc/<packagename>
directory. It contains any other relevant information that the developers want to share but that is not available in the man page of that package. You may find PDF, HTML, or TXT file-based documentation, license agreements, sample configuration files, and so on inside these directories.
Besides the preceding sources of documentation, if you have a GUI installed, thengnome-help
orKhelpcenter
are other sources of documentation available on the system. The online community of CentOS 7 also contains vast resources of documentation and help. Each Linux distribution has its own user-driven forums and Wiki sections.
TheCentOSdocumentation is available at https://www.centos.org/docs/, but is being merged with the RHEL documentation at http://access.redhat.com, as CentOS has limited resources by comparison.
Some useful commands that give descriptions of othercommandsare as follows:
-
Whatis
: This command displays a short description of binaries available in the Linux system. Its database is updated daily inCentOS7 with the help of another command,makewhatis
. -
Whereis
: This command locates the binary, source, and manual pages of the given command. -
Which
: This commandtakesone or more command names as argument, and returns the absolute path of the given command name.