2.2 Using the Command Line to Get Help (Weight: 2)
📘Linux Essentials (LPI 010-160)
In Linux systems, documentation is built directly into the operating system. This allows users and administrators to quickly access help and learn how commands work without leaving the terminal.
Two of the most important documentation systems in Linux are:
- Manual pages (man pages)
- Info documentation
These tools provide detailed explanations of commands, configuration files, and system functions. Understanding how to use them is an important skill for the Linux Essentials (LPI 010-160) exam.
1. Manual Pages (man Pages)
1.1 What Are Manual Pages?
Manual pages are the built-in help documentation for Linux commands, system calls, libraries, configuration files, and administrative tools.
They provide detailed information such as:
- Command description
- Syntax
- Available options
- Configuration details
- Related commands
Manual pages are accessed using the man command.
1.2 Basic Syntax
man command_name
Example:
man ls
This command opens the manual page for the ls command, which lists directory contents.
1.3 How Manual Pages Are Displayed
Manual pages are displayed using a pager program, usually less. This allows users to scroll through the documentation.
Common navigation keys:
| Key | Function |
|---|---|
| Arrow Up/Down | Move line by line |
| Page Up / Page Down | Scroll one page |
| Space | Move forward one page |
| b | Move backward one page |
| /keyword | Search for a word |
| n | Go to next search result |
| q | Quit the manual page |
Example search inside a man page:
/permissions
This searches for the word permissions inside the documentation.
2. Structure of a Manual Page
Most manual pages follow a standard structure. Not every page contains all sections, but the common sections include:
NAME
Shows the command name and a short description.
Example:
ls - list directory contents
SYNOPSIS
Shows the basic command syntax.
Example:
ls [OPTION]... [FILE]...
This means:
- The command may include options.
- It can also include file or directory names.
DESCRIPTION
This section explains what the command does and how it works.
Example:
The description of the ls command explains how it displays files and directories.
OPTIONS
Lists all available options that can be used with the command.
Example:
-l use long listing format
-a show hidden files
-h display file sizes in human-readable format
These options change how the command behaves.
EXAMPLES
Some manual pages include examples showing how the command can be used.
Example:
ls -l /home
This displays detailed information about files in the /home directory.
SEE ALSO
This section lists related commands and documentation.
Example:
cp(1), mv(1), rm(1)
This suggests other commands related to file management.
3. Manual Page Sections
Manual pages are organized into numbered sections based on their type.
For the exam, it is important to understand that different types of documentation belong to different sections.
| Section | Content |
|---|---|
| 1 | User commands |
| 2 | System calls |
| 3 | Library functions |
| 4 | Devices and special files |
| 5 | Configuration files |
| 6 | Games |
| 7 | Miscellaneous information |
| 8 | System administration commands |
Example
To open a manual page from a specific section:
man 5 passwd
This shows documentation about the /etc/passwd configuration file.
Another example:
man 1 passwd
This shows the user command passwd, which changes passwords.
4. Searching Manual Pages
Linux provides several methods for searching documentation.
4.1 Searching by Keyword (man -k)
The man -k command searches manual page descriptions for keywords.
Syntax:
man -k keyword
Example:
man -k password
This searches for commands related to passwords.
This command is similar to the apropos command.
Example:
apropos password
Both commands search manual page descriptions.
4.2 Searching Man Page Names (whatis)
The whatis command displays a short description of a command from the manual page database.
Example:
whatis ls
Output example:
ls (1) - list directory contents
This helps quickly identify what a command does.
5. Viewing Man Pages Without Formatting
Sometimes administrators want to view the raw manual page content.
Example:
man ls | cat
However, this is rarely needed for normal use.
6. Updating the Man Page Database
Commands such as man -k and whatis rely on a database of manual page descriptions.
This database may need to be updated using:
mandb
System administrators may run this command after installing new software.
7. Info Documentation System
7.1 What Is the Info System?
The Info system is another documentation format used in Linux.
It is often used for large or complex documentation.
Info pages are usually:
- More detailed than manual pages
- Organized like hyperlinked documents
- Divided into nodes (sections)
7.2 Opening Info Pages
To open documentation using the Info system:
info command_name
Example:
info ls
This opens the Info documentation for the ls command.
7.3 Navigating Info Pages
Info pages are interactive and use keyboard commands for navigation.
Common navigation keys:
| Key | Function |
|---|---|
| Arrow keys | Move through text |
| Enter | Open a link |
| n | Next node |
| p | Previous node |
| u | Move up one level |
| l | Go back |
| q | Quit |
Nodes work like sections of documentation that link to each other.
8. Structure of Info Documentation
Info documentation is organized in a hierarchical structure.
Example structure:
Top
├── Introduction
├── Command Options
├── Examples
└── Advanced Features
Users can move between nodes to explore different parts of the documentation.
This system is useful for complex software documentation such as:
- system utilities
- development tools
- GNU utilities
9. Differences Between Man Pages and Info Pages
| Feature | Man Pages | Info Pages |
|---|---|---|
| Structure | Linear document | Hyperlinked nodes |
| Detail Level | Shorter | More detailed |
| Navigation | Scroll/search | Menu-based navigation |
| Usage | Quick reference | Full documentation |
10. Using Documentation in an IT Environment
In IT environments, administrators frequently rely on built-in documentation to understand commands and system behavior.
Common situations include:
Checking command options
man tar
Used to find options for creating or extracting archive files.
Understanding configuration files
man 5 ssh_config
Used to learn about SSH configuration parameters.
Searching for tools related to a task
man -k network
Used to find commands related to networking.
Reading advanced documentation
info coreutils
Used to access detailed documentation for GNU utilities.
11. Important Commands for the Exam
| Command | Purpose |
|---|---|
man command | Open manual page |
man section command | Open a specific section |
man -k keyword | Search manual pages |
apropos keyword | Search descriptions |
whatis command | Show short command description |
info command | Open info documentation |
mandb | Update manual page database |
12. Key Points to Remember for the Exam
- Linux provides built-in documentation systems.
- Manual pages are the most commonly used help system.
- Use
man commandto read command documentation. - Manual pages have standard sections like NAME, SYNOPSIS, and DESCRIPTION.
- Documentation is organized into numbered sections.
man -koraproposcan search manual pages by keyword.whatisdisplays a short command description.- Info documentation provides detailed and structured documentation.
- Use
info commandto access Info pages. - Navigation inside documentation uses keyboard commands.
