📖 Command: man (Manual)
The man command is the built-in interface to the system's reference manuals. It is essentially the "Official Encyclopedia" for almost every command, utility, and configuration file on your Linux system.
1. The "Why"
Even the most experienced Linux experts don't memorize every flag for every command. When you're deep in your doctoral research or configuring a complex Arch Linux service, you need accurate, offline documentation.
You use man when:
- You forget which flag
chmoduses for recursive changes. - You want to see the detailed technical explanation of how
grephandles regular expressions. - You need to know the specific file format for a configuration file in
/etc/. - You are offline and can't search Google for a command's syntax.
2. Basic Syntax
man [COMMAND_NAME]
- Example:
man lsopens the manual page for the "list" command.
3. Understanding the Sections
Manual pages are organized into sections to help you find exactly what you're looking for:
| Section | Content Type |
|---|---|
| 1 | General Commands: Executable programs or shell commands (e.g., ls, grep). |
| 5 | File Formats: Descriptions of configuration files (e.g., /etc/fstab). |
| 8 | System Admin: Commands for root (e.g., pacman, fdisk). |
Example: man 5 fstab specifically looks for the file format description rather than a command.
4. Navigating a Man Page
When you open a manual, it uses the less pager (which we covered earlier), so the navigation is the same:
- Arrow Keys / Space: Scroll up and down.
/[keyword]: Search for a specific word inside the manual.n/N: Go to the next/previous search result.q: Quit and return to the terminal.
5. Standard Manual Layout
Almost every manual page follows this structure:
- NAME: The name and a one-line description.
- SYNOPSIS: A compact "cheat sheet" showing all possible flags and arguments.
- DESCRIPTION: A detailed explanation of what the command does.
- OPTIONS: A list of every single flag (like
-r,-f,-v) and what they do. - EXAMPLES: Practical ways to use the command (usually at the bottom).
6. Pro-Tips
- "What is this?": If you don't want the full manual but just a one-line summary, use the
whatiscommand:whatis grep - Search for Commands: If you don't know the exact name of a command but know what it does, use
-k(keyword):man -k "partition" - Arch Linux Context: Arch is known for its "RTFM" (Read The Fine Manual) culture. Because Arch is minimalist, the local man pages are often more accurate for your specific installation than general online tutorials.
- The "User Manual": For very complex tools like
bash, the man page is huge (thousands of lines). Use searching (/) to find specific sections quickly.
7. Summary Reference
| Goal | Command |
|---|---|
| View command manual | man command |
| View a specific section | man 5 filename |
| Find commands by keyword | man -k keyword |
| Show one-line summary | whatis command |
| Open man page in a browser | man -H command (If configured) |