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.

  • Beginner
  • Linux VPS
  • 5 min read

By RunRacks Team · Published

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:

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

Terminal
help cd

Read the manual with man

man opens the full manual page for a command:

Terminal
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.

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:

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

Terminal
apropos "disk usage"
man -k firewall

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

Terminal
sudo mandb

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

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

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

Terminal
sudo apt install man-db manpages

For AlmaLinux and Rocky:

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

Terminal
tldr tar

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

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

Terminal
tldr --update

The exact update option differs slightly between tldr clients; run tldr --help to check yours.

Check it works

Run each of these and confirm you get output:

Terminal
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

Was this guide helpful?

Still stuck?

Ask RunRacks AI for a quick answer, or open a ticket and our team will take a look at your server.

Getting started

Edit files with nano: a beginner's guide

Open, edit, search and save files with the nano text editor on a Linux server, including cutting and pasting lines, showing line numbers and safely editing system config files with sudo.

  • Beginner
  • Linux VPS
  • 5 min read

Getting started

Your first hour with a new RunRacks server

A step-by-step roadmap for the first hour after your RunRacks server is delivered, from finding your login details to changing the password, updating the OS and picking your next guides.

  • Beginner
  • All
  • 5 min read

Getting started

How to choose a server location

Pick a data center location based on where your users, broker or team are, confirm it with ping tests, and weigh the legal and latency points that come with each choice.

  • Beginner
  • All
  • 4 min read