Finding Help and Documentation
One of the most critical skills for mastering Linux is learning how to find help on your own. The system has a comprehensive, built-in documentation system that can teach you about almost any command. This guide covers the essential tools you’ll use to find documentation and discover new commands.
Why This Matters: You will never memorize every command and every option. Knowing how to look up information quickly and efficiently is what separates a novice from an expert. This is your key to becoming self-sufficient on the command line.
man: The System Manual
The man (manual) command is your primary source for detailed documentation. It provides access to the official system manual pages for commands, configuration files, system calls, and more.
How to Use man
To view the manual page for a command, simply type man followed by the command name:
man lsThis will open the manual page for the ls command in a pager (usually less), allowing you to scroll through the documentation.
Navigating a man Page
Since man uses less to display content, you can use the same navigation keys:
| Key | Action |
|---|---|
| Space | Move forward one screen |
| b | Move backward one screen |
| Up/Down | Scroll by line |
| /pattern | Search forward for a term |
| n | Find the next search match |
| q | Quit the man page |
Structure of a man Page
Manual pages are organized into standard sections, which makes them easy to read once you’re familiar with the layout:
- NAME: The name of the command and a brief one-line description.
- SYNOPSIS: The command’s syntax, showing how to use it with options and arguments.
- DESCRIPTION: A detailed explanation of what the command does.
- OPTIONS: An alphabetized list of all command-line options and what they do.
- EXAMPLES: Practical examples of how to use the command.
- FILES: A list of files related to the command (e.g., configuration files).
- SEE ALSO: A list of related commands and manual pages.
Pro Tip: The SYNOPSIS and EXAMPLES sections are often the most useful for getting started quickly.
Manual Page Sections
Linux manuals are divided into numbered sections. Sometimes, the same name exists in multiple sections (e.g., passwd the command vs. passwd the file format).
You can specify a section number to get the correct page:
man 1 passwd→ Shows the manual for thepasswdcommand.man 5 passwd→ Shows the manual for the/etc/passwdfile format.
Standard Manual Sections:
| Section | Description |
|---|---|
| 1 | Executable programs or shell commands |
| 2 | System calls (functions provided by the kernel) |
| 3 | Library calls (functions within program libraries, like libc) |
| 4 | Special files (usually found in /dev) |
| 5 | File formats and conventions (e.g., /etc/passwd) |
| 6 | Games |
| 7 | Miscellaneous (overviews, conventions, and protocols) |
| 8 | System administration commands (usually for root) |
| 9 | Kernel routines [Non standard] |
If you don’t specify a number, man searches the sections in order and shows the first match it finds.
--help: The Quick Reference
For a faster, more concise summary of a command’s options, most commands provide a --help flag.
ls --helpOutput:
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).
Sort entries alphabetically if none of -cftuvSUX nor --sort is specified.
-a, --all do not ignore entries starting with .
-A, --almost-all do not list implied . and ..
--author with -l, print the author of each file
... (output truncated) ...man vs. --help
- Use
--helpwhen you just need a quick reminder of a command’s syntax or a specific option. - Use
manwhen you need a detailed understanding of what a command does, how it works, and want to see practical examples.
apropos and whatis: Discovering Commands
What if you know what you want to do, but you don’t know the name of the command? The apropos command searches the NAME section of all manual pages for a keyword.
apropos
Imagine you want to find commands related to “users”:
apropos "user"Output:
useradd (8) - create a new user or update default new user information
userdel (8) - delete a user account and related files
usermod (8) - modify a user account
users (1) - print the user names of users currently logged in
...This is an incredibly powerful way to discover new tools.
whatis
The whatis command gives you the one-line description from the NAME section of a man page. It’s a very quick way to identify a command.
whatis lsOutput:
ls (1) - list directory contentsDid you know?
The apropos and whatis commands are actually shortcuts for flags to the man command itself:
apropos <keyword>is the same asman -k <keyword>.whatis <command>is the same asman -f <command>.
info: Hypertextual Documentation
The info command provides access to the GNU Project’s documentation system. info pages are often more in-depth than man pages and are structured like a website with hyperlinks (called “nodes”).
info coreutilsWhile powerful, the info interface can be less intuitive than man. For most day-to-day tasks, man and --help are sufficient.
/usr/share/doc: Package Documentation
Finally, the /usr/share/doc directory contains documentation installed by software packages. Here, you can often find README files, configuration examples, tutorials, and other detailed information that doesn’t fit in a man page.
ls /usr/share/doc/bashOutput:
README examples/ FAQ NEWS ...This is a great place to look for in-depth guides and sample configurations.
Summary
man <command>: Your primary tool for detailed, comprehensive documentation.<command> --help: The best option for a quick syntax and options reminder.apropos <keyword>: Your discovery tool for finding commands related to a topic.whatis <command>: Provides a brief, one-line description of a command./usr/share/doc: A directory containing extra documentation from installed packages.
Next Steps: With the ability to find help and navigate the command line, you are now ready to start managing files and directories. The next section will cover creating, copying, moving, and deleting files.