Using man, info, and --help - How to Read Official Documentation
What You'll Learn
By the end of this article, you'll be able to:
- Understand the difference between --help, man, and info and when to use each
- Navigate man pages with keyboard shortcuts and search
- Find commands by keyword when you can't remember the name
Quick summary
- Quick option check →
command --help - Full reference →
man command - Can't remember the command name →
man -k keyword
1. --help: The Quickest Way
Usage
ls --help
Usage: ls [OPTION]... [FILE]... List information about the FILEs (the current directory by default). -a, --all do not ignore entries starting with . -A, --almost-all do not list implied . and .. -l use a long listing format ...(truncated)
If the output is too long to fit on screen, pipe it through less:
ls --help | less
Press q to exit.
Some commands also accept -h as a short form. Try curl -h as an example.
When to use --help
| Property | Details |
|---|---|
| Speed | Immediate |
| Amount | Concise (option list) |
| Coverage | Almost all commands |
| Best for | Checking option names and syntax |
2. man: Full Manual Pages
Usage
man ls
You navigate man pages with the same keys as less.
Keyboard Shortcuts
| Key | Action |
|---|---|
Space / f |
Next page |
b |
Previous page |
q |
Quit |
/keyword |
Search forward (e.g. /recursive) |
n |
Next search result |
N |
Previous search result |
g |
Jump to top |
G |
Jump to bottom |
The / search shortcut is the most useful. Try man chmod, then type /octal to jump straight to the numeric permission section.
Structure of a man Page
Every man page follows the same section layout:
| Section | Contents |
|---|---|
| NAME | Command name and one-line description |
| SYNOPSIS | Usage syntax |
| DESCRIPTION | Detailed explanation |
| OPTIONS | All available options |
| EXAMPLES | Usage examples (when included) |
| SEE ALSO | Related commands |
Specifying Section Numbers
Some names have entries for both a command and a configuration file. Use a number to get the right one:
man 1 passwd # The passwd command man 5 passwd # The /etc/passwd file format
Common section numbers:
| Number | Contents |
|---|---|
| 1 | User commands (what you type in the shell) |
| 5 | File formats and configuration files |
| 8 | System administration commands |
3. man -k: Search by Keyword
man -k compress
bzip2 (1) - a block-sorting file compressor, v1.0.8 compress (1) - compress and expand data gzip (1) - compress or expand files xz (1) - Compress or decompress .xz and .lzma files zip (1) - package and compress (archive) files
man -k and apropos are the same command. Use whichever you find easier to remember.
If you get "nothing appropriate", run sudo mandb first to update the manual database.
4. info: Detailed GNU Documentation
Usage
info grep
Keyboard Shortcuts
| Key | Action |
|---|---|
| Space / PageDown | Next page |
b / PageUp |
Previous page |
q |
Quit |
n |
Next node (section) |
p |
Previous node |
u |
Up to parent node (table of contents) |
| Enter | Follow a link |
If info is not installed, man will be shown instead. On Ubuntu, install it with sudo apt install info.
5. Which Tool to Use
| Goal | Use |
|---|---|
| Check an option quickly | command --help |
| Read full command documentation | man command |
| Find a command by what it does | man -k keyword |
| Deep dive into GNU tools | info command |
Common scenarios
- Check options for
ls -la→ls --help - Look up how
chmodnumbers work →man chmod - Find a compression command →
man -k compress - Learn advanced
awkusage →info awk