2.2 Using the Command Line to Get Help

Key Takeaways

  • man displays the manual page for a command, file format, or topic; press q to quit the pager and use /pattern to search within a page
  • Manual pages are grouped into numbered sections — section 1 is user commands, 5 is file formats, 8 is administration commands
  • info often provides a hyperlinked Texinfo manual that can be deeper than a short man page; navigate with arrows, Enter, and q to quit
  • /usr/share/doc/ holds packaged documentation (README, HTML, examples) installed with software on many distributions
  • locate searches a prebuilt filename database for path matches and is typically faster than a full filesystem find for name lookups
Last updated: July 2026

When you forget a switch or meet an unfamiliar command, Linux expects you to help yourself from the terminal. Objective 2.2 covers the classic help stack: man, info, files under /usr/share/doc/, and locate for finding documentation or other files by name.

man: The System Manual

man ls
man 5 passwd
man man

man formats a manual page and sends it to a pager (commonly less). Essential pager keys:

KeyAction
Space / fNext page
bPrevious page
Arrow keys / j kLine movement
/patternSearch forward for pattern
nNext search hit
qQuit back to the shell

A typical man page includes NAME, SYNOPSIS, DESCRIPTION, OPTIONS, and sometimes EXAMPLES or SEE ALSO. Read the SYNOPSIS carefully: square brackets mean optional items; | separates alternatives; ellipses ... mean “more of the same.”

Manual Sections

Pages are stored in numbered sections. The same name can exist in more than one section (classic example: passwd).

SectionContentsExample
1Executable user commandsman 1 ls
2System callsman 2 open
3Library functionsman 3 printf
4Special files (devices)man 4 null
5File formats and conventionsman 5 passwd
6Games(rarely needed)
7Miscellany (protocols, standards)man 7 man
8System administration commandsman 8 useradd

For Essentials, prioritize 1, 5, and 8. If man passwd shows the command instead of /etc/passwd’s format, request the section explicitly: man 5 passwd.

whatis ls          # one-line summary from the whatis database
man -k copy        # approximate keyword search (same idea as apropos)

man -k / apropos search short descriptions — useful when you remember what you want but not the command name.

info: Hyperlinked Texinfo Manuals

GNU projects often ship richer documentation as Info documents:

info ls
info coreutils
info bash

Info readers present a menu of nodes. Common navigation:

ActionTypical key
Follow a menu itemEnter on the link
Next / previous noden / p (in many info readers)
Up to parent menuu
Quitq
Searchs then pattern

Compared with man, info manuals may include tutorials and deeper cross-links. If man feels too terse, try info for the same topic. Not every command has an Info document; when none exists, the reader says so and you fall back to man or /usr/share/doc/.

/usr/share/doc/: Packaged Documentation

Distributions install per-package documents under /usr/share/doc/:

ls /usr/share/doc/
ls /usr/share/doc/bash/
less /usr/share/doc/bash/README

You often find README, changelog, copyright, example configs, and HTML manuals. This tree is ideal when:

  • You need examples or packaging notes not in the man page.
  • A package ships a long HOWTO only as a file.
  • You are browsing offline on a minimal server.

Remember the path itself — fill-in questions may ask where additional documentation is stored, and /usr/share/doc/ is the expected answer.

locate: Fast Name Search

locate passwd
locate '*.desktop'
locate README | head

locate queries a prebuilt database of file paths (updated by a periodic job such as updatedb). Strengths and caveats:

AspectBehavior
SpeedUsually much faster than walking the whole disk with find
FreshnessMay miss brand-new files until the database is refreshed
ScopeMatches path substrings; use patterns carefully
PrivilegeDatabase may omit directories the indexing user could not read

For objective 2.2, use locate to find documentation files or command paths by name. Example workflow:

locate bash | grep '/usr/share/doc'
# narrow results to documentation paths

Do not confuse locate with which/type (command resolution) or with man -k (description search). Each tool answers a different question.

When to Use Which Helper

NeedStart with
Exact options for a known commandman command
File format of a config (e.g. passwd structure)man 5 name
Broader GNU tutorial / linked chaptersinfo topic
README / examples shipped with a packageBrowse /usr/share/doc/package/
“Where is that file?” by namelocate pattern
“What command mentions backup?”man -k backup or apropos backup

Worked Scenario

You need the meaning of chmod’s symbolic mode and also want the package’s README:

man 1 chmod          # read OPTIONS and examples; q to quit
info coreutils       # optional deeper GNU docs if installed
ls /usr/share/doc/coreutils/
locate 'chmod*'

If man chmod opens but you cannot leave, you forgot q. That navigation detail appears in training materials because new users often feel “stuck” inside the pager.

One-Line Summaries and Keyword Search

Before opening a full page, you can ask the whatis database for a short description:

whatis printf
apropos editor
man -k permission

whatis (and the related man -f) expects a name and returns a concise summary. apropos / man -k search those summaries for a keyword, which helps when you remember the task (“compress”, “calendar”, “password”) but not the utility. If the database was never built on a minimal install, these helpers may return nothing until the administrator generates the index — another reminder that help tools depend on local documentation packages being present.

Sometimes the same name exists in multiple sections. man -a passwd walks through every matching page so you can compare the command (section 1) with the file format (section 5). On a timed exam item, naming the section explicitly is faster and clearer than paging through every hit.

Choosing Help Under Time Pressure

Walk a decision path the way you will on test day:

  1. You know the command name and need flags → start with man command (section 1 by default).
  2. You know a config file name and need field meanings → try man 5 name or look under /usr/share/doc/ for examples.
  3. The man page is too short or points you to a Texinfo manual → run info on the same topic.
  4. You do not know where a README or example file liveslocate a distinctive fragment of the path or filename, then open it with less.
  5. You only remember a verb (“schedule”, “archive”) → man -k / apropos to discover candidate commands, then read their man pages.

That sequence keeps you from randomly mixing tools. locate will not explain options; man will not search the whole disk for a misplaced example script; /usr/share/doc/ will not refresh itself when you invent a new file in /tmp.

locate Freshness and Permissions

Because locate reads a database (commonly maintained by updatedb via cron or a systemd timer), results can lag. A file you created moments ago may be invisible until the next update. Conversely, a deleted file might still appear until the database is rebuilt. If a locate search surprises you, consider freshness before assuming the file never existed.

Permissions also matter: paths the indexer could not read may be absent from the database. For Essentials, remember the design goal — fast name lookup from an index — and contrast it with a live recursive search that walks directories in real time (deeper find skills show up more in later objectives).

Exam Tips

  • Match the tool to the job: man for reference pages, info for Texinfo manuals, /usr/share/doc/ for packaged files, locate for path search.
  • Know section numbers at least for 1 (commands) and 5 (file formats).
  • Know q exits the man/info pager; / searches inside less.
  • locate depends on its database — a missing recent file is not always a failure of the command itself.
  • Prefer man -k / apropos when you have a keyword but not a command name; prefer whatis when you already have the name and want a one-line reminder.

With these helpers, you can answer “what does this switch do?” without leaving the command line — exactly the skill Linux Essentials weights in Topic 2.

Test Your Knowledge

Which command opens the manual page describing the format of the /etc/passwd file rather than the passwd command?

A
B
C
D
Test Your Knowledge

While reading a man page in the usual pager, which key returns you to the shell prompt?

A
B
C
D
Test Your Knowledge

Where do many Linux distributions store package-shipped README files and other supplemental documentation?

A
B
C
D
Test Your Knowledge

What is the main advantage of using locate filename instead of walking the entire filesystem for a name match?

A
B
C
D