You do not need to memorize every option before using a terminal. You do need to find help for the implementation you will run, read its notation, and turn one documented choice into a command whose effect you understand. A manual page is a reference, not a list of exercises to execute from top to bottom.
This lesson connects three help routes: Bash's builtin help, an external
program's own help, and a local manual page. You will use documentation to
explain a harmless directory listing. Your independent task is to investigate
rmdir's empty-directory condition without running rmdir.
Start in the checked Bash guest
Complete Run commands and interpret their results
first. Work in the ordinary account of the checked Ubuntu course guest, using
Bash. Keep your current home or practice directory; this exercise creates no
files and needs no new exercise directory. The earlier preflight supplies
man, its manual pages and the less reader.
Use the already taught checks if you are resuming a session. id -u must show
a nonzero account ID; ps -p $ -o comm= must identify bash as the current
shell. Bash substitutes its own process ID for $.
id -u
ps -p $ -o comm=
There are no package installations, profile edits or administrator commands in this task. If a required command or manual is missing, record that specific readiness gap and return to the guest setup rather than improvising an install.
Ask which command the documentation describes
The previous lesson introduced type: it inspects how Bash resolves a name
without running that command. Inspect the commands in the worked comparison:
type cd ls
In ordinary Bash, cd is a builtin. ls is an external directory-listing
program, but the shell can also have an alias for it. Ubuntu's normal Bash
setup may, for example, show an alias that adds color. An alias does not mean
the underlying program has disappeared. Record what your shell actually says;
do not remove the alias to make an example look simpler.
For this lesson we will inspect the external ls independently of any alias.
In Bash's type -P ls, -P forces a search for an external executable in the
command-search directories, even when the name also has an alias, function
or builtin. It does not describe which alias a bare ls would select, and it
does not run the executable. The distinction matters: ordinary resolution and
the external program's location are two different observations.
type -P ls
The selected Ubuntu installation normally reports /usr/bin/ls. Record the
actual absolute pathname. Use /usr/bin/ls in the commands below only when
that is the inspected program. If the verified distribution program is at
another expected path, substitute that complete path consistently. A missing
or unfamiliar executable location is a setup question to resolve before
invocation. Do not execute an unexpected program merely because lookup found it.
If cd resolves to an unexpected customization, record that difference and
reconcile the declared Bash setup. The builtin documentation below describes
Bash's cd, not a custom function someone happened to give the same name.
Choose the help route
| What you need | Route | What it describes |
|---|---|---|
Bash builtin such as cd | help cd | The builtin supplied by the running Bash. This displays help; it does not change directory. |
A short option summary for the inspected external ls | /usr/bin/ls --help | That selected executable's help output. --help is an option understood by GNU ls, not a universal shell feature. |
| A navigable local reference | man -P less 1 ls | The installed section 1 manual named ls, displayed using the selected less reader. |
help is a Bash builtin; cd is its topic argument in the first command.
Run it and find the description of the optional directory argument:
help cd
Read what the builtin says about omitting that argument. You are gathering information here, not practising directory changes. The help is printed in the terminal; wait for the normal prompt before the next command.
For the external program, the inspected path identifies which executable gets
the argument. GNU ls interprets --help as a request for usage information:
/usr/bin/ls --help
Find the usage line and the entry for -a / --all. This program's short and
long option spellings are alternatives for the same behavior: including
entries whose names begin with a dot. Do not assume that the same spellings
have the same meaning in a different command.
Read a synopsis as notation
A synopsis is a compact description of accepted command structure. It is
usually a pattern to interpret, not a complete line to paste. GNU ls shows
this form:
ls [OPTION]... [FILE]...
| Notation here | How to read it | What to type in our example |
|---|---|---|
ls | The command being documented | The inspected executable pathname identifies this implementation. |
[OPTION] | An optional option argument; square brackets mark optional material | Choose -a; omit the brackets and the word OPTION. |
[FILE] | An optional file or directory operand; FILE is a placeholder | Use . for the current directory, a meaning already used during setup. |
... | The preceding kind of argument can be repeated as allowed by the command | No ellipsis is needed for our one-directory example. |
An operand is an argument naming an input or target rather than selecting
an option. Here . is the directory to list. The synopsis also permits an
invocation without those optional arguments, but we will state our directory
explicitly to make the request easy to explain.
Optional groups can contain several related pieces, not just one uppercase word. Read the surrounding explanation before deciding which pieces belong together. A filename placeholder is not necessarily capitalized in every manual; typography and conventions vary. Recognize the notation from its context instead of literally typing brackets, placeholders or ellipses.
Predict: in /usr/bin/ls -a ., which argument selects behavior and which
names the directory? How would typing the synopsis literally differ from
making that choice? Keep your answer while you check the manual.
Open the right manual section and use its reader
man retrieves installed manual pages. A manual section identifies a
category of topic, not an app version or a course chapter. Section 1 includes
ordinary user commands, section 5 covers file formats, and section 8 covers
system-administration commands. The same topic name can occur in different
sections, so the number can disambiguate it. A heading such as LS(1) names
the ls page in section 1.
In man -P less 1 ls, -P less tells man which pager to use for this
invocation; 1 selects the section, and ls names the topic. A pager is a
reader that lets you move through text a screen at a time. Selecting less
explicitly avoids depending on a different configured reader. It does not
change your shell's settings. Notice that man's -P means something different
from Bash type's -P: each command interprets its own options.
Know the reader keys before opening the page:
Action in the selected less reader | Keys |
|---|---|
| Move forward one screen | Space |
| Move back one screen | b |
| Search forward for the option text | Type /--all, then press Enter. The slash starts the reader's search; it is not a shell command. |
| Repeat the most recent search forward | n |
| Leave the reader and return to the shell | q |
Run the manual command, inspect its heading and synopsis, and find the -a /
--all explanation with the search action above. Try forward/backward movement
and the repeated search, then leave with q:
man -P less 1 ls
If there is no later match when you press n, the reader may report that it
cannot find another occurrence. That does not mean the command option stopped
existing. You can move back or quit. If the selected page or reader is missing,
record the error as a readiness gap. If the page is open, type reader keys,
not shell commands; wait until you have quit and see the normal prompt before
returning to command input.
Guided task: turn one option into a harmless request
Your goal is to find a supported option in local documentation, explain its
input, and compare the actual result with that explanation. The checked guest,
inspected ls executable and current directory are the complete starting
inputs. The effect is a directory listing in the terminal; no files are changed.
- Confirm that you found
-a/--allin both the executable's help and its local section 1 manual. Explain what the option adds to an ordinary listing. - Return to the shell with
qif the manual reader is still open. Check that the executable pathname matches the one you inspected earlier. - Predict the command word, option and operand, then run this supported request:
/usr/bin/ls -a .
The option is -a; . names the current directory. The listing should include
the entries . and .., and any other names present there, including other
names beginning with a dot. Names, order and display details depend on the
directory and terminal. Do not create files to make your listing resemble a
sample. The unchanged current directory is the intended input.
Success is being able to point to the relevant documentation, interpret the synopsis and explain the actual listing. Returning to the prompt alone does not establish those things. These are your checks, not automatic grading.
Match documentation to the installed tool
The program's own --help belongs to the executable you invoked. A local
manual is an installed documentation file: it is useful, but a custom executable
or mismatched package could describe a different version. An online manual can
also describe newer features than the course's selected tool family.
GNU ls's --version prints its version and exits without listing or changing
files. Use the same inspected path if you need to compare the installed version
with the manual's identification:
/usr/bin/ls --version
The selected Ubuntu 24.04 route uses GNU coreutils 9.4. Record your actual version; do not install a newer tool just to match an online example. Builtin help follows the running Bash, whose 5.2 family was checked earlier. When documentation disagrees, inspect the command origin, local version and source version before attempting an unfamiliar option.
Diagnose a help problem
| Observation | Interpretation and next step |
|---|---|
| Bash builtin help is needed, but an external manual was opened | Confirm the active command with type; use help for the builtin behavior under discussion. |
ls is an alias | Keep it unchanged. Locate the external executable with the taught type -P query and use only its inspected path for this task. |
| Manual page is absent | The documented preflight is incomplete or the topic/section was mistyped. Check the exact name and section, then return to setup if still missing. |
| Terminal displays a manual and does not respond like a shell | It is still in the reader. Use the taught reader keys and q; do not paste more shell commands there. |
| A synopsis copied literally produces unexpected input | Replace placeholders with actual arguments and omit the notation's brackets/ellipses. Read the argument's documented meaning first. |
| A documented option is rejected by the selected executable | Recheck origin, exact spelling and installed/documentation versions. Do not assume the newest web page describes this executable. |
Independent task: investigate removal without doing it
The name rmdir suggests removing a directory. Your task is to find its actual
condition before the later file-removal lesson. Do not invoke rmdir, even
with a help option, in this exercise. Inspecting its name and reading its
manual are sufficient; create or remove no directories.
- Use
type rmdirto inspect ordinary resolution andtype -P rmdirto locate the external command. Record any unexpected alias, function or location rather than changing it. These lookups do not run the target. - Open its section 1 manual with the selected
lesspager, using the pattern taught forls. Find the condition its directory inputs must satisfy. - Explain, from the documentation, what should happen for an ordinary nonempty directory. Do not test it by constructing or deleting anything.
- Interpret the directory placeholder in the synopsis. Is the word printed there a literal directory you should create? Identify what a real operand would represent without proposing or executing a removal command.
- Quit the reader and explain why
help cdand the section 1rmdirmanual answer questions about different implementations.
Hints
Hint 1 — choose the source: help describes Bash builtins. The independent
task concerns the external rmdir, whose manual is a section 1 command page.
Hint 2 — look for the condition: after opening the manual, search for
empty with the reader's / search. The answer concerns the directory's
contents, not just its name or your current working directory.
Hint 3 — separate reading from acting: names in a synopsis stand for the operands someone would supply to an invocation. You need to interpret that pattern here, not supply a real removal target.
Answer and Reasoning
The documentation-only lookup and manual sequence is:
type rmdir
type -P rmdir
man -P less 1 rmdir
The first two commands inspect how the name is understood; the third opens a
manual. None invokes rmdir. In the reader, type /empty, press Enter and
read the surrounding explanation. Use n for a later match if helpful, and
q to finish. The operative condition is that a directory must be empty for
ordinary rmdir removal. A nonempty directory is not removed by that ordinary
request. Other access or filesystem conditions can also prevent removal;
emptiness is a necessary condition, not a promise of universal success.
The manual's directory placeholder names the kind of operand an invocation would receive. It is not an instruction to create a directory with that literal placeholder name. If a synopsis permits repeated directory operands, the ellipsis expresses that repetition; it is not text to type. This exercise ends with the explanation, not a removal attempt.
help cd describes the builtin in the running Bash. The section 1 rmdir
manual describes an external command's interface. Name inspection comes first
because a function or alias with the same spelling would not automatically
have that interface. The manual can still be read as documentation, but an
unexpected resolution is a reason not to infer what an invocation would do.
For the guided listing, the synopsis became the explicit inspected executable,
the supported option -a, and the real operand .. The option includes names
beginning with a dot; the operand names the directory whose entries are listed.
The . and .. results are part of the expected observation, while other names
depend on your starting directory. No literal brackets, OPTION, FILE or
ellipsis belonged in the command.
Finish or resume
Quit any open manual with q and finish at the ordinary Bash prompt. Nothing
in this task requires file cleanup, package removal or configuration reset.
Retain the checked guest and its help tools.
If interrupted, establish whether you are still inside less before typing a
shell command. Quit it if necessary, confirm the ordinary guest/Bash session,
and repeat the read-only lookup or documentation step you had not finished.
Keep the independent task documentation-only even when repeating it. A missing
manual or unexplained implementation difference stays a specific setup gap
until resolved; reading another page does not silently complete that check.
Technical references
- GNU Bash 5.2-family manual — builtin help, command classification and forced external lookup with
type -P. - GNU coreutils manual — the documented
lsoptions and the empty-directory condition ofrmdir; use the longstanding behavior shown for the selected 9.4 family. - Ubuntu Noble man manual — manual sections, topic selection and invocation-specific pager selection.
- Ubuntu Noble less manual — the reader's navigation, search and exit keys.
- Debian man-db 2.11.2 companion manual and Debian less 590 companion manual — additional references for the specific pager-selection and navigation behavior shown. These versions are identified explicitly; use your installed documentation when distribution versions differ.
Use Revision to reconstruct the help choices and Quick Reference for the supported patterns.