Getty Images/iStockphoto
Everything you need to know about Linux man pages
Admins who aren't familiar with a command can use Linux man pages for better understanding. This tutorial outlines how to access Linux manuals and the value they provide.
When Unix was first introduced, there was little documentation on how to use it. Users struggled to figure out how to use the OS, which led to considerable problems.
That led to the creation of the first-ever Unix document, the "Unix Programmer's Manual," initially published on Nov. 3, 1971. Dennis Ritchie and Ken Thompson wrote the manual at the request of their manager, Douglas Mcllroy. That first manual would become the first of many binders to serve as documentation for the early iterations of Unix. Eventually, those binders migrated to online manuals to become the first computer documentation accessible in a machine-readable form.
Those manuals inspired what are called man pages, short for manual pages, and are included with every Unix and Linux OS. This system became so crucial to Linux that it gave birth to the man program, which makes it easy to read man pages.
The construction of a man page
For nearly every program installed on a Linux machine -- whether it's a server or a desktop -- there's a man page that is read via the man command.
All man pages are broken into sections. Not every man page contains every section, but all developers should follow the same layout for their man pages.
A typical man page is broken down into the following sections:
- name
- synopsis
- configuration
- description
- options
- exit status
- return value
- environment
- files
- versions
- attributes
- conforming to
- notes
- bugs
- example
- see also
The sections of the man pages that are the most helpful for typical admin tasks are synopsis (the structure of the command), description (a description of the command) and options (options that are available to the command). These sections alone should give admins a good idea of how the command in question works.
Man pages are not only for command-line applications. Some GUI apps, such as Thunderbird, also include their own man pages.
Viewing man pages
Organizations may task admins with doing something in Linux where they are not familiar with the commands. For example, you might have to use the ip command, and it may be new to you.
Under normal circumstances, you might search for help using that command. But, if you don't have any internet connection, open a terminal window, and issue the following command:
man ip
The above command opens the man page for the ip command, where you can learn the ins and outs of its general use.
You can scroll through that man page by either hitting the space bar, which scrolls one page at a time, or via the cursor keys, which scroll one line at a time.
When you issue the basic man command, such as man ip, you are taken to the General Commands page for the command or app, which is page 1.
There can, however, be more pages to view. Those pages are broken down into sections:
- general commands
- system calls
- library functions
- special files
- file formats and conventions
- games and screensavers
- miscellanea
- system administration commands and daemons
Not every app or command has multiple pages. To find out which pages are available, issue the following command:
man -f COMMAND
COMMAND is the name of the command or app in question. For example, if you want to see what manual pages are available to the ip command, that would be the following:
man -f ip
The above command reveals two pages:
ip (8) - show/manipulate routing, network devices, interfaces…
ip (7) - Linux IPv4 protocol implementation
To view a specific section of a man page, the command would be the following:
man X COMMAND
X is the section number, and COMMAND is the command or application in question. For example, to view section 8 of the ip man page, the command would be the following:
man 8 ip
Most often, help is found in the general commands section. Make sure to check to see if the man page has other sections if you don't find what you need.
Man pages are important to Linux and the open source community because they are an easy way to access help information, whether a machine is online or not.