Which section of the manual documents file formats, and which section documents system calls?
The manual explains its own structure.
Look at the manual page of man itself.
man man, then search for the table of sections with /section.
You are the help desk. Answer 15 questions from colleagues without using the web. Use only: man, help, --help, apropos / man -k, whatis, type, and the shell.
Ubuntu 24.04 in WSL2, a VM or the course container. No board required.
sudo apt update && sudo apt install -y man-db manpages manpages-dev strace
mkdir -p ~/m1/s01 && cd ~/m1/s01The proof command matters more than the answer: it shows you can find the answer again.
Nothing checked off yet. Start with task 1.
The manual explains its own structure.
Look at the manual page of man itself.
man man, then search for the table of sections with /section.
ls option prints sizes as 4.0K, 12M instead of raw bytes? (It only shows sizes together with another option. Which one?)The answer is in the full description of ls.
man ls, then search for the word "human".
-h works together with -l (or -s).
echo a builtin, a program on disk, or both? How does Bash choose which one runs?There is a tool that tells you what a name is.
type has an option to show all matches.
type -a echo. The first line shown is the one Bash runs.
python3?Same tool as Q3.
type shows the path for programs on disk.
type python3 (or type -a python3).
cd - do?cd is a builtin. Builtins have no man page.
Builtins are documented by Bash itself.
help cd, look at the description of the - argument ($OLDPWD).
Search the manual by keyword, not by name.
apropos (= man -k) searches the NAME lines.
Describe what it does in the manual's words: apropos -a file system space; look for a short name.
write appears in two manual sections. What does each one describe?Same name, different sections.
man -f write (= whatis write) lists them.
Compare man 1 write and man 2 write.
History entries are numbered.
history shows the numbers.
!7 re-runs entry 7.
It is a Ctrl combination.
Think "R" for reverse.
Ctrl-R, then type part of the command.
PATH? List them one per line.PATH is a variable. Print it.
Directories are separated by :.
echo "$PATH" | tr ':' '\n', then count with wc -l.
type ll print on your machine? What is ll?Same tool as Q3.
ll is not a program on disk.
type ll shows an alias (defined in ~/.bashrc on Ubuntu).
Every command sets a status.
The status of the last command is in a special variable.
nosuchcmd; echo $?
recursive, and then jump to the next match?The man viewer is less.
Searching in less starts with a slash.
/recursive, Enter, then n for next and N for previous.
Bash has a version option and a variable.
Try --version.
bash --version or echo "$BASH_VERSION".
cd cannot be a separate program in /usr/bin. Prove that cd does not create a new process using strace.Every process has its own current directory.
What happens to a child's directory when the child exits?
strace -f -e trace=clone,clone3,execve,chdir bash -c 'cd /tmp; pwd' - look for chdir and the absence of a new process for cd.
Found a problem? Report an issue or Edit this page on GitHub.
Questions and fixes are public, so the next learner finds the answer too.