A copied command contains an option you cannot explain. Look it up before running the command, especially if the command can change files. An option's letter can mean different things in different programs.
A builtin is a command implemented inside the shell. cd is a Bash builtin because it must change that shell's working directory. An external program runs separately. Bash's help describes its builtins, while man commonly opens installed manuals for named commands.
Before you begin
- Recommended first
- Install Ubuntu LTS and open a terminal, Where practice is allowed, The filesystem
- Estimated time
- 15 min reading, 15 min activity. Setup and optional practice may take longer.
- Where you work
- Use Bash in your owned Ubuntu practice environment as an ordinary user. The supplied text files use UTF-8, a text encoding; where shown, LC_ALL=C requests consistent text ordering. Work only under your own new ~/yanosec-lab directory, never a host share or personal/system file. Refuse an existing exercise destination rather than overwriting it. No account, paid platform, or remote target is required. Optional extensions take about 10–15 minutes and are not part of the time above. A virtual machine is optional. You can also finish the reasoning from the printed evidence.
- Without a lab
- The page supplies the files, source and text records needed for the activity. Without a shell, follow the numbered steps on paper, label each result as predicted, and use the separate evidence supplied by the question. Running commands can wait until your lab is available. Reading works without JavaScript. Answer checking needs JavaScript and a secure context, such as HTTPS; saving a correct result also needs usable browser storage. Missing tools, managed or mobile hosts, or a deferred guest setup never require buying a service. Keep owned lab files for review; do not use broad deletion.
After this lesson you can:
- Choose builtin help or a program manual for a named command.
- Locate a listing option's meaning and exit a pager.
- Combine navigation, copying and help in a short evidence note.
01Example
The earlier exercise record used Bash 5.2.21. help cd supplied builtin usage, and the ls documentation described -a as including dot entries. These are retained observations from that exercise, not output from a new run. Pager actions below describe a less-style pager.
Command:
help cd
Earlier recorded result, summarized:
Builtin usage describing directory changes
Command:
man ls
Pager actions: /all then Enter; n for next match; q to leave
Alternative command:
ls --help
Earlier recorded meaning: -a, --all includes dot entries02Choose and read the relevant source
type cd asks Bash how it resolves the command name: which implementation it would use. help cd then describes that builtin. For an external program such as ls, use its --help option or man ls. Prefer documentation matching the version you actually use.
A manual's SYNOPSIS is a compact description of accepted command forms. Square brackets usually mark optional parts; placeholders stand for values you supply. Do not copy the notation literally without reading its explanation.
man often uses a pager, a program for reading longer text one screen at a time. In a less-style pager, / followed by a word searches, n moves to the next match, and q leaves. The worksheet also supplies the facts you need if man or its pager is unavailable.
Choose builtin help, manual or program help; preserve the exact option meaning and pager controls.Model. A teaching model drawn by hand. It shows the idea, not real tool output.
Read the full explanation below.
Earlier course record, summarized
help cd
man ls
/all then Enter; n for next match; q to leave
ls --help
-a, --all includes dot entries
cd is a shell builtin; help cd is the relevant builtin-help route.
This summarizes an earlier course record.
cd is a shell builtin; help cd is the relevant builtin-help route.
Follow the explanation
- cd is a shell builtin; help cd is the relevant builtin-help route.
- man ls uses a pager: search /all, Enter, next match n, leave q.
- ls --help gives the same -a / --all dot-entry meaning.
Read every state and value
1. cd is a shell builtin; help cd is the relevant builtin-help route.
- Selected parts
- builtin
- Explanation
- builtin
2. man ls uses a pager: search /all, Enter, next match n, leave q.
- Selected parts
- manual · Pager controls
- Explanation
- manual
3. ls --help gives the same -a / --all dot-entry meaning.
- Selected parts
- Program help · Option meaning
- Explanation
- option
03Try finding an option
The activity asks you to find the option that includes dot names. This is a different task from the final question about documenting cd. Read the short worksheet first so you know what information to look for.
On paper, label help cd as builtin documentation, man ls as a manual, and ls --help as the program's own summary. Use the supplied meaning of -a to predict a listing containing .notes. No manual installation is required to make this comparison.
Choose help for the command you are using
These short summaries explain where to look; they are not complete
manual pages. A builtin belongs to the shell. A pager displays long
text. Use the supplied option meaning if no manual is installed.
help cd: Bash supplies builtin help for directory changes.
man ls: installed manual opens if present; pager/navigation may vary.
In a less-style pager: /all then Enter searches; n repeats; q exits.
ls --help: external program's own option summary, normally no pager.
Expected reasoning: ls -a includes entries beginning with a dot.
Fallback summary: cd changes the shell working directory; ls lists
directory entries; -a includes dot entries; grep searches file content.
Question task: choose Bash builtin help for cd: help cd or man grep.
Shell module case: shell-case/originals/source.txt = copper newline.
work/.keep = original empty-work placeholder (newline).
List archive first; copy source into work/copy.txt; replace only copy
with silver; inspect both; locate the hidden-file listing option.
Expected: original copper; copy silver; identify -a from help.
- Run help cd in Bash or read the fallback summary. State which command needs help and why changing the shell directory is a builtin task.
- Use man ls if present, locate the entry describing all dot names and leave with q in a less-style pager. If man is absent, use ls --help; do not improvise an installation before the package lesson.
- Write the discovered option and its meaning. Expected: -a includes dot entries. Confirm your reasoning using the owned tree from the previous lesson rather than an unfamiliar host directory.
- Record the help source and actual observed behavior, or label the worksheet prediction. Stop after leaving the pager; no file cleanup is needed.
04The shell module case
Combine the path, file-copy and help skills in one short note. The shell-case archive contains originals/source.txt with copper and work/.keep with a harmless placeholder line. Those are its complete ordinary file contents.
List the archive before extracting it into a new shell-review destination, using the archive guide. Copy source.txt into work/copy.txt with cp -i, replace only that copy with silver, then read both. On paper, trace the same two file states instead.
Check your note against this rubric: identify the working directory, preserve copper in the original, place silver only in the copy, and explain how -a includes the dot name. Label results as observed or predicted according to how you worked. Keep the small tree for review.
Read an owned archive before extracting it
An archive bundles named entries. Extracting writes those entries back
to disk. A .tar.gz file uses tar bundling plus gzip compression; neither
operation encrypts the content. Use only the supplied owned archives.
All supplied archives contain original ordinary text files under one
named directory. No symlinks, executables with special modes, devices,
absolute paths or parent traversal entries are authored. Inspect first.
Save the chosen archive in the GUEST Downloads folder. If its actual
location differs, use that quoted absolute path; do not guess.
Use a new destination beneath ~/yanosec-lab, never an existing folder.
Example templates (replace ARCHIVE.tar.gz and NEW-DEST):
tar -tzf ~/Downloads/ARCHIVE.tar.gz
mkdir ~/yanosec-lab/NEW-DEST
tar -xzf ~/Downloads/ARCHIVE.tar.gz -C ~/yanosec-lab/NEW-DEST
Run the extraction only if mkdir succeeded and inventory matches.
t lists; x extracts; z handles gzip; f names archive; -C names target.
Keep original data; do not use sudo, overwrite flags or root extraction.
Stop on an unexpected path/link/member or download you cannot identify.
Fallback: read the full inline tree and contents; predict actions in notes.
Cleanup: leave scoped files for review; restore a guest baseline only
if all subsequent guest work is disposable. No broad rm command.
05Optional challenge
Allow about ten extra minutes. A web example uses an unfamiliar grep option. Explain why finding the same letter in ls help would not establish its meaning. Name the command implementation and documentation version you would check before using that option.
06Fresh cases for the checks
Use these fictional cases for the checks below. They have different inputs from the worked examples. Read them here or make notes; no installation or external service is needed.
Help card A: document the implementationOwned fixture. An original file made for this course. Follow the activity's instructions in your own lab.
A supplied Bash resolution note says: printf is a shell builtin.
Goal: read Bash builtin documentation for that command, without running a printing task.
Help card B: a separate external programOwned fixture. An original file made for this course. Follow the activity's instructions in your own lab.
A supplied resolution note identifies cp as the external copy program in this case.
Goal: open its installed manual page, rather than copy any file.
The manual is installed. Use the command name without a section number or options.
Help card C: an adapted listing-help excerptOwned fixture. An original file made for this course. Follow the activity's instructions in your own lab.
These supplied meanings are sufficient for the task; this is not a new terminal recording.
-a, --all do not ignore entries starting with .
-l use a long listing format
-r, --reverse reverse order while sorting
Owned folder queue contains .ticket and arrival.txt.
Goal: include .ticket in the listing. No file content or permission should change.
Help card D: a manual remains openOwned fixture. An original file made for this course. Follow the activity's instructions in your own lab.
You are reading a manual in the less-style pager described in the lesson.
You have found the needed option and want to return to the shell prompt.
The active program is the pager, not a shell or an editor.
Do not execute the example command displayed in the manual.
Help card E: a changed documentation targetOwned fixture. An original file made for this course. Follow the activity's instructions in your own lab.
A web example uses grep -r. You have only the ls excerpt from Help card C.
grep is a separate external program in this case.
You have not looked up the grep option or run the web example.
07Review an evidence note
Optional self-check: outline a note for a new owned copy-and-list task. Include the working directory, source and disposable copy paths, documentation source, discovered option meaning, and whether the resulting file and listing observations were predicted or actually observed.
Review your note: preserve the original; identify the command implementation before choosing help; use the documented option meaning for that program; distinguish reading a manual from executing its examples; and record the two file states separately. This explanation is self-reviewed.
08Common mistakes
If q prints a character instead of leaving, you may not be in a pager. Identify the active program first; Ctrl+C can cancel a foreground help command, but do not confuse the pager with your editor later.
If man is absent, use the tool's --help or the complete fallback. Missing documentation does not justify copying an unreviewed modifying command.
If help prints another command's syntax, inspect which name followed help. Command names, options and versions matter; these examples are not literal manual dumps.
References
- Ubuntu 24.04 packaged manual: bash(1)
Shell grammar, quoting, builtins, redirection and job control; use only the sections introduced in this lesson. Use the named command and option sections. This manual describes Ubuntu 24.04 packages; your installed version can differ. The lesson supplies the facts needed for its activity.
- Ubuntu 24.04 packaged manual: ls(1)
Use the named command and option sections. This manual describes Ubuntu 24.04 packages; your installed version can differ. The lesson supplies the facts needed for its activity.
- Ubuntu 24.04 packaged manual: tar(1)
Use the named command and option sections. This manual describes Ubuntu 24.04 packages; your installed version can differ. The lesson supplies the facts needed for its activity.