Getting started

Get help in Linux: man pages, --help and tldr

Find out what any Linux command does without leaving the server, using --help, man pages, man sections, apropos for searching, and tldr for short practical examples.

BeginnerLinux server5 min read

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

Quick help with --help

Most commands print a short summary of their options when you add --help:

Bash
ls --help
cp --help | less

The 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:

Bash
help cd

Read the manual with man

man opens the full manual page for a command:

Bash
man ls
man sshd_config

Man 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 /EXAMPLES and 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:

  1. User commands, such as ls and ssh.
  2. System calls (for programmers).
  3. Library functions (for programmers).
  4. Special files in /dev.
  5. File formats and config files, such as crontab(5) and passwd(5).
  6. Games.
  7. Overviews and conventions.
  8. Admin commands, such as useradd and sshd.

When a name exists in more than one section, add the number. crontab is both a command and a file format:

Bash
man crontab
man 5 crontab

The 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):

Bash
apropos "disk usage"
man -k firewall

If apropos returns nothing appropriate, the search index may be out of date. Rebuild it:

Bash
sudo mandb

whatis shows just the one-line description of a known command:

Bash
whatis tar

Install 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:

Bash
sudo unminimize

It 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:

Bash
sudo apt install man-db manpages

For AlmaLinux and Rocky:

Bash
sudo dnf install man-db man-pages

Short 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:

Bash
tldr tar

To install a client, use the distribution package where one exists. On Ubuntu and Debian:

Bash
sudo apt install tldr

On 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:

Bash
tldr --update

The 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:

Bash
ls --help | head
man -k password | head
whatis ssh

Then 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. Run sudo unminimize on Ubuntu minimal, or install man-db and man-pages.
  • apropos finds nothing: rebuild the index with sudo mandb.
  • --help is not recognised: try -h, help, or man <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.
Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.