Getting Help (man & --help)
One of the biggest mindset shifts when learning Linux is realising that almost every answer you need is already on your machine. Instead of opening a browser and guessing, you can ask the command itself how it works. Linux ships built-in documentation for nearly every tool, and learning to read it makes you faster, more confident, and far less likely to run a command that does the wrong thing. This page covers the four ways to get help on the command line: the man pages, the --help flag, apropos for searching, and the friendlier modern tool tldr.
Why reading docs beats guessing
A command like rm (remove files) or dd (copy raw disk data) can destroy data in a second if you pass the wrong option. Guessing the flags is how people accidentally wipe a disk. The documentation tells you exactly what each option does before you press Enter. On a server you administer, this habit is not optional, it is the difference between a safe change and an outage.
Tip: Before running any command you found copy-pasted from the internet, read its
--helpormanpage first. Understand every flag, especially anything with-r(recursive),-f(force), or--no-preserve-root.
Using man pages
man stands for “manual”. It opens the full reference manual for a command in a scrollable pager (a program that shows text one screen at a time). This is the most complete and authoritative source of help on a Linux system.
man ls
This opens the manual for ls (list directory contents). You will see sections like NAME, SYNOPSIS, DESCRIPTION, and OPTIONS.
Navigating inside man
The man page opens in a pager called less. You do not scroll with your mouse, you use the keyboard:
| Key | What it does |
|---|---|
Space or f | Page down |
b | Page up |
↓ / ↑ | Line down / up |
/word | Search forward for “word” |
n | Jump to next search match |
N | Jump to previous match |
g | Go to the top |
G | Go to the bottom |
q | Quit and return to the shell |
If you ever get “stuck” inside a man page and your prompt disappeared, just press q to quit.
Man page sections
The manual is split into numbered sections. The same name can exist in more than one section. For example, passwd is both a command (section 1) and a config file format (section 5).
| Section | Contents |
|---|---|
| 1 | User commands (e.g. ls, cp) |
| 5 | File formats and config files (e.g. /etc/passwd) |
| 8 | System administration commands (e.g. systemctl, ufw) |
To open a specific section, put the number first:
man 5 passwd
This shows the format of the /etc/passwd file, not the passwd command.
The —help flag
Most commands accept a --help flag (and often a short -h) that prints a quick summary of usage and options directly to your terminal. This is faster than man when you just need to remember one flag.
ls --help
Output:
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 .
-l use a long listing format
-h, --human-readable with -l and -s, print sizes like 1K 234M 2G etc.
--help display this help and exit
--version output version information and exit
The difference: man is the full reference, --help is the quick cheat sheet. Use --help for a fast reminder, man when you need the full story.
Gotcha: A few older commands print help when given a wrong flag instead of
--help, and some use-hfor something else entirely (inls,-hmeans “human-readable sizes”, not help). When in doubt, try--helpfirst.
Searching with apropos
What if you do not know the command name? apropos searches the short descriptions of every man page for a keyword. The name comes from “a propos” (French for “regarding”).
apropos "list directory"
Output:
dir (1) - list directory contents
ls (1) - list directory contents
vdir (1) - list directory contents verbosely
Now you know ls is the command you wanted. On a fresh Ubuntu install you may need to build the search index once:
sudo mandb
A close relative is whatis, which gives a one-line description of a command you already know:
whatis systemctl
Output:
systemctl (1) - Control the systemd system and service manager
The friendlier tldr tool
Man pages are thorough but can be overwhelming when you just want a practical example. tldr (“too long; didn’t read”) shows short, community-written pages full of real-world examples for the most common uses of a command.
Installing tldr on Ubuntu
On Ubuntu 22.04 and 24.04, install it with apt:
sudo apt update
sudo apt install -y tldr
tldr --update
The tldr --update step downloads the latest example pages. Now try it:
tldr tar
Output:
tar
Archiving utility.
- Create an archive from files:
tar cf target.tar file1 file2 file3
- Create a gzipped archive:
tar czf target.tar.gz file1 file2 file3
- Extract a (compressed) archive into the current directory:
tar xf source.tar[.gz]
- List the contents of a tar file:
tar tvf source.tar
That is far easier to absorb than the full man tar, which has dozens of options.
When to use which
| Tool | Use it when |
|---|---|
man | You need the complete, authoritative reference and every option |
--help | You want a quick reminder of flags without leaving your prompt |
apropos | You do not know the command name and want to search by topic |
tldr | You want practical copy-paste examples for common tasks |
Best Practices
- Read the
manor--helppage of any destructive command (rm,dd,mkfs,chmod -R) before running it, especially on a server. - Use
--helpfor a quick flag check andmanwhen behaviour surprises you, the answer is almost always in the DESCRIPTION. - Install
tldron every server you manage so example-driven help is one command away. - Run
sudo mandbonce after install soaproposandwhatiscan search descriptions. - Remember
qquits any man page or pager, you are never truly stuck. - Specify the section number (e.g.
man 5 crontab) when a name exists as both a command and a config file.