Every Linux server carries its own manual. When you meet an unfamiliar command or forget an option, the answer is usually one keystroke away, and it matches the exact version installed on your server. This guide shows the three main ways to get help: --help, man pages and tldr.
Before you start
- SSH access to your Linux VPS. See Connect to your Linux VPS with SSH.
- Some minimal images ship without man pages. The steps below show how to add them if needed.
Quick help with --help
Most commands print a short summary of their options when you add --help:
ls --help
cp --help | lessThe output lists each option and what it does. Pipe it into less when it is longer than a screen. Some programs use -h instead, and a few use help as a subcommand, such as systemctl help or git help.
Built-in shell commands like cd, export and history have no separate program. Use the help builtin for them:
help cdRead the manual with man
man opens the full manual page for a command:
man ls
man sshd_configMan pages exist for commands, but also for config files (man sshd_config, man crontab) and system concepts. They open in a pager, usually less, so the same keys work:
- Space / b: next / previous page.
- /word then Enter: search. n for the next match, N for the previous.
- g / G: start / end.
- q: quit.
How a man page is laid out
Most pages follow the same order:
- NAME: the command and a one-line description.
- SYNOPSIS: how to call it. Text in
[brackets]is optional, and...means you can repeat the item. - DESCRIPTION: what it does and each option in detail.
- EXAMPLES: not every page has these, but they are worth jumping to. Type
/EXAMPLESand press Enter. - SEE ALSO: related commands and pages.
Tip: To find a specific option quickly, search for it with a leading space and dash, for example / -r in man rm.
Man sections
The manual is split into numbered sections. The common ones:
- User commands, such as
lsandssh. - System calls (for programmers).
- Library functions (for programmers).
- Special files in
/dev. - File formats and config files, such as
crontab(5)andpasswd(5). - Games.
- Overviews and conventions.
- Admin commands, such as
useraddandsshd.
When a name exists in more than one section, add the number. crontab is both a command and a file format:
man crontab
man 5 crontabThe first opens the command (section 1); the second explains the file syntax. When guides write crontab(5), they mean section 5.
Search the manual with apropos
If you do not know the command name, search the one-line descriptions with apropos (or man -k, which is the same):
apropos "disk usage"
man -k firewallIf apropos returns nothing appropriate, the search index may be out of date. Rebuild it:
sudo mandbwhatis shows just the one-line description of a known command:
whatis tarInstall man pages on a minimal server
Ubuntu minimal and cloud images may strip documentation to save space. If man ls says the page is missing or was removed, run:
sudo unminimizeIt is only available on minimised Ubuntu images. It reinstalls documentation and other removed content, which can take a few minutes and some disk space.
On Debian, AlmaLinux or Rocky Linux, install the man package if it is missing. For Debian:
sudo apt install man-db manpagesFor AlmaLinux and Rocky:
sudo dnf install man-db man-pagesShort examples with tldr
Man pages are complete but long. tldr shows a handful of practical examples for common commands, which is often exactly what you need:
tldr tarTo install a client, use the distribution package where one exists. On Ubuntu and Debian:
sudo apt install tldrOn AlmaLinux and Rocky, tldr is available from the EPEL repository on many releases. Package names and availability change, so check dnf search tldr after enabling EPEL. After installing, update the local page cache once:
tldr --updateThe exact update option differs slightly between tldr clients; run tldr --help to check yours.
Note: tldr pages are written by the community and cover the most common uses only. For anything that changes your system, confirm the options in the man page.
Check it works
Run each of these and confirm you get output:
ls --help | head
man -k password | head
whatis sshThen open man 5 crontab, search for /EXAMPLE, and press q to quit.
Troubleshooting
No manual entry for X: the package has no man page, or docs were stripped. Runsudo unminimizeon Ubuntu minimal, or installman-dbandman-pages.aproposfinds nothing: rebuild the index withsudo mandb.--helpis not recognised: try-h,help, orman <command>.tldr: command not found: install a client as shown above, then run its update command once.
Next steps
- Review the basics: Linux command line basics.
- Keep a quick reference: Linux commands cheat sheet.
- Fix missing commands: Fix "command not found" in Linux.
