Skip to content
Français
Account: not signed in, sync available My learning
Select theme
Français

Getting help on Linux

By updated

Improve this page

You will never remember every option of every Linux command, and that is normal. The real skill of a system administrator is not to know everything by heart, but to find the information in seconds without leaving the terminal. This guide shows the tools built into every Linux system for exactly that.

What you will learn

  • Display the quick help of a command with --help
  • Read the full documentation with man
  • Navigate a man page (search, move forward, quit)
  • Find a command by keyword with apropos and whatis
  • Choose the right help tool for the situation

Installing the help tools

On a minimal installation, do not assume what is there. The picture varies from one distribution to another, and not always the way you would expect: on a minimal AlmaLinux 10, man, apropos and whatis are present, with 3,100 manual pages, but info is missing and the man-pages package is not installed. On a "minimized" Ubuntu, it is the other way round: /usr/bin/man is only a 320-byte script inviting you to run unminimize.

The reflex that settles it, before installing anything:

Terminal window
command -v man apropos whatis info

The missing tools come with the packages below.

Terminal window
sudo apt install man-db manpages manpages-dev info pipx
pipx install tldr
sudo mandb
tldr --update

The packages in detail. The man-db row is the one that matters: without it, no man page can be read at all, and apropos has nothing to search.

PackageProvidesWhy it is needed
man-dbman, apropos, whatisThe documentation engine: without it, no man page can be read
manpages / man-pagesThe generic pages (system calls, C functions, conventions)Without it, sections 2, 3 and 7 are empty; the pages shipped by each package stay
infoinfoExtended GNU documentation (optional)
pipxpipxInstall Python tools in isolation
tldr (via pipx)tldrCommunity cheat sheets of practical examples (optional)

The sudo mandb command builds the index used by apropos and whatis. Without that step, those commands always return nothing appropriate.

Quick help: --help

It is the simplest reflex. Almost every Linux command accepts the --help option, which prints a summary of the syntax and of the main options:

Terminal window
ls --help

You get a summary of the syntax, of the main options and sometimes examples. The output usually fits on one screen.

Terminal window
cp --help
mkdir --help

The right moment for --help is when you already know the command and only look for the name of an option: the answer fits on one screen, where the full man page asks you to navigate.

Some commands use -h instead of --help (or as well). If --help does not work, try -h.

Full documentation: man

man (manual) is the documentation system built into Linux. Every command, configuration file and system function has a man page.

Terminal window
man ls

You enter an interactive pager (less). Here are the essential keys:

KeyAction
SpaceMove forward one page
bMove back one page
/ then a wordSearch the page
nNext search result
NPrevious result
qQuit

Structure of a man page

Man pages follow a standard layout. Knowing its sections lets you find the information without reading everything: jump to SYNOPSIS for the syntax, to OPTIONS for a switch, to EXAMPLES for something to copy.

SectionContentWhat you look for there
NAMEName and short descriptionCheck that it is the right command
SYNOPSISUsage syntaxSee the expected options and arguments
DESCRIPTIONDetailed explanationUnderstand what the command does
OPTIONSFull list of optionsFind the option you need
EXAMPLESUsage examplesCopy an example and adapt it
FILESRelated configuration filesFind where to change the behaviour
SEE ALSORelated commands and pagesDiscover complementary commands
EXIT STATUSExit codesUnderstand errors in a script

When you are in a hurry, the pager search is the shortcut: type /EXAMPLES in the man page then Enter, and you jump straight to the examples, without reading the previous sections.

The manual sections

The manual is organised in numbered sections. Some names exist in several sections at once, such as passwd, which is both a command and a configuration file:

SectionContent
1User commands
5File formats and conventions
8System administration commands

To read a specific section:

Terminal window
man 5 passwd # the format of the /etc/passwd file
man 1 passwd # the passwd command

Without a number, man shows the first section it finds.

Finding a command: apropos and whatis

These two commands query an index of the manual pages, not the pages themselves. On a fresh installation that index may be missing: sudo mandb builds it.

apropos: "I do not know the command"

You know what you want to do, but not which command does it. apropos searches the short descriptions of every installed man page for the words you type:

Terminal window
apropos "copy files"
apropos partition
apropos "network interface"
Example output
cp (1) - copy files and directories
scp (1) - OpenSSH secure file copy
rsync (1) - a fast, versatile, remote (and local) file-copying tool

whatis: "I know the command, what is it in one line?"

whatis prints the short description of a command, the one from the NAME section of its man page:

Terminal window
whatis ls cp mkdir rm
Output
ls (1) - list directory contents
cp (1) - copy files and directories
mkdir (1) - make directories
rm (1) - remove files or directories

info: extended documentation (GNU)

Some GNU tools (coreutils, grep, sed, awk) offer info pages that are more detailed than their man pages, with extra examples:

Terminal window
info coreutils
info grep

Navigation is different: Enter follows a link, u goes up, q quits. In practice, man pages are enough 95% of the time.

tldr: concrete examples, right away

Man pages are complete but sometimes intimidating for a beginner. tldr (Too Long; Didn't Read) offers community cheat sheets of practical examples, right in the terminal:

Terminal window
tldr tar
Example output
tar
Archiving utility.
Often combined with a compression method, such as gzip or bzip2.
- Create an archive from files:
tar cf target.tar file1 file2 file3
- Extract an archive in the current directory:
tar xf source.tar
- Create a gzipped archive:
tar czf target.tar.gz file1 file2 file3
- Extract a gzipped archive in the current directory:
tar xzf source.tar.gz

Each sheet shows the 5 to 8 most frequent use cases with commands ready to copy.

Offline documentation: /usr/share/doc

Installed packages sometimes drop documentation into /usr/share/doc/: README files, changelogs and configuration examples.

Terminal window
ls /usr/share/doc/openssh-server/

You will find README files, a CHANGELOG, configuration examples. It helps when the man page does not cover a specific case.

Which tool should you use?

The right reflex depends on what you already know. Read the Situation column first: if you know the name of the command, --help then man are enough; if you do not, apropos searches the descriptions of every installed page. The difference matters, because looking up an unknown command with man never returns anything.

SituationToolExample
I know the command, I look for an option--helptar --help
I need the full reference of a known commandmanman tar
I do not know which command does the jobaproposapropos archive
I want concrete examples quicklytldrtldr tar
I look for detailed examples (GNU)infoinfo tar
I look for a configuration fileman 5man 5 fstab

Practical exercise

  1. Show the quick help of ls:

    Terminal window
    ls --help

    Spot the option that shows sizes in a readable format (KB, MB).

  2. Open the man page of cp:

    Terminal window
    man cp

    Search /recursive to find the option that copies directories. Quit with q.

  3. Look for a command that shows disk space:

    Terminal window
    apropos "space usage"

    You find df and du:

    df (1) - report file system space usage
    du (1) - estimate file space usage
  4. Check with whatis:

    Terminal window
    whatis df du

Why "space usage" and not "disk usage"

The phrase that comes naturally to mind, apropos "disk usage", returns neither df nor du. It is not a bug: apropos looks for the words you type in the actual descriptions of the pages, and the coreutils ones say report file system space usage and estimate file space usage. The word "disk" appears nowhere.

Depending on what is installed on the machine, you get either disk usage: nothing appropriate. (exit code 16), or, more puzzling still, other unrelated pages that do contain the phrase:

podman-system-df (1) - Show podman disk usage
quota (1) - display disk usage and limits

The lesson holds for every use of apropos: search with the vocabulary of the page, not your own. If an attempt returns nothing, rephrase with a synonym closer to the jargon, or search several words at once with apropos -a file space usage.

Troubleshooting

Almost all of these symptoms share one cause: the manual pages or their index are not on the machine. It is common on container images and minimal installations, where documentation is removed to save space. Before concluding that a command does not exist, check that its page exists, with man -w.

SymptomCauseFix
No manual entry for xxxMan page not installedInstall the man-db package and the command's package
whatis: command not found or apropos: command not foundman-db not installedsudo apt install man-db manpages (Debian) or sudo dnf install man-db man-pages (RHEL)
apropos returns nothing appropriateMan pages missing, index not built, or keyword absent from the descriptionssudo mandb; then rephrase with the pages' vocabulary (space usage, not disk usage)
apropos answers, but not with the expected commandThe keyword exists in other pageswhatis <command> to read its actual description, then search with those words
apropos silent although the index is up to dateThe page was removed from diskman -w <command> tells whether the page still exists
tldr: command not foundPackage not installedInstall it with pipx install tldr
tldr returns nothingLocal database missingRun tldr --update to download the sheets
tldr --update fails with Did not find end of central directory signatureBuggy Haskell client (the tldr package from Debian/RHEL repositories)Remove the system package (sudo apt remove tldr), then install the Python client: pipx install tldr
--help prints too much textLong outputUse ls --help | less to page through it

Put it into practice

Finding things fast takes practice on real questions. This lab drops you into a disposable shell with puzzles to solve using man, --help and apropos: find the right option, the right section, the right command, and the output you produce is compared with the expected result.

Key points

  • --help gives a quick reminder of a command's options.
  • tldr shows practical examples ready to copy, ideal for commands you rarely use.
  • man is the reference documentation. Type / to search, q to quit.
  • apropos finds a command by keyword when you do not know its name.
  • whatis gives the one-line description of a known command.
  • A minimal installation may lack some of these tools: check with command -v man apropos whatis info before installing anything.
  • The real skill is not to remember everything, it is knowing how to search fast.

Knowledge check

Make sure the essentials of this guide are yours. The questions only cover what was explained here.

Knowledge check

Check what you have learned with this interactive quiz

6 questions
6 min
70% to pass

How it works

  • The timer starts when you click Start
  • Multiple choice, true/false and short answer questions
  • You can move between questions
  • Detailed results are shown at the end

Starts the quiz and the timer

Is this project useful to you?

The guides, courses, quizzes and labs stay free. If you use them regularly, you can contribute to their upkeep and development.

Become a supporting member (new tab) One-time support (new tab) Learn more

Follow the project on LinkedIn