Module 10 · Putting it all together
Final project and course review
The final exam: a review of all ten modules, a twelve-question theory test and three practical tasks that combine files, pipes, find and grep, permissions, scripting, archives and checksums.
What you will learn
- Review the key commands of every module in one place.
- Pass a theory test that spans the whole course.
- Solve three practical problems that each need several modules at once.
Ninety-nine lessons ago a blinking prompt was a mystery. Now you can move around the filesystem, bend text through pipes, find anything, control who may touch what, watch and stop processes, inspect the system, pack and fetch files, and write scripts that do all of it for you. This last lesson is the final exam. Read the review, answer the twelve questions, and then solve the three practical tasks in the VM. None of them needs anything new; each one needs several things you already know, used together.
The course on one page
| Module | Key ideas and commands |
|---|---|
| 1. First steps | Prompt, pwd, ls -la, cd, absolute vs relative paths, --help, Tab and history |
| 2. Files and directories | mkdir -p, touch, cp -r, mv, rm -r, cat, less, head, tail -f, wildcards |
| 3. Text and pipes | >, >>, 2>, 2>&1, |, wc, sort, uniq -c, cut, tr, tee, vi |
| 4. Finding things | grep -inrvc, regular expressions, find -name -type -size -mtime, -exec, sed, awk |
| 5. Users and permissions | id, /etc/passwd, adduser, su, rwx, chmod 750 / u+x, chown, umask |
| 6. Processes | ps, top, &, jobs, fg, kill, signals, nice, nohup, /proc |
| 7. System and environment | uname, free, df -h, du -sh, mount, dmesg, date, export, .profile |
| 8. Archives and network | tar cf/tf/xf, gzip, gunzip -c, ifconfig, ping, nslookup, wget, netstat |
| 9. Scripting | Shebang, variables and quotes, $( ), $(( )), if [ ], for, while, functions, $1 $# $@, exit |
| 10. Putting it together | ln -s, alias, PATH, xargs -0, diff -u/patch, &&/||/{ }, crontab, sha256sum -c |
How to approach the practical tasks
Build every solution step by step. Run the first command of a pipeline alone and look at its output, then add the next stage. Before you redirect into a file, print to the screen. Before a script is executable, run it with sh -x. When a check fails, go back to the checklist of lesson 99: read the message, look at $?, test the path. Absolute paths everywhere make your commands independent of where you happen to be.
~% find /root/lab/l100/logs -name '*.log'
~% find /root/lab/l100/logs -name '*.log' | xargs grep -h ERROR
~% find /root/lab/l100/logs -name '*.log' | xargs grep -h ERROR | sort -u
~% … > /root/lab/l100/errors.txt # only when the screen output is right
Remember two quirks of this VM while you work. BusyBox tar has no z option, so a .tar.gz is made in two steps, tar cf - DIR | gzip > file.tar.gz, and listed with gunzip -c file.tar.gz | tar tf -. And there is no bash: scripts start with #!/bin/sh and use POSIX syntax, exactly as you learned in module 9.
Where to go next
Everything here was BusyBox, the smallest common denominator. On a full distribution such as Debian, Fedora or Alpine you will find the same commands with more options, man pages for each of them, bash with arrays and [[ ]], a package manager (apt, dnf, apk) and systemd services instead of a bare crond. The habits transfer unchanged: read the usage line, test small, pipe small tools together, quote your variables and keep a backup before you change anything. Congratulations on finishing the course.
Commands in this lesson
| Command | What it does |
|---|---|
find DIR -name '*.log' | xargs grep -h PATTERN | Search matching files, lines only. |
sort -u | Sort and drop duplicates. |
chmod 750 script.sh | rwx owner, r-x group, nothing for others. |
tar cf - DIR | gzip > DIR.tar.gz | Compressed archive with BusyBox tar. |
gunzip -c F.tar.gz | tar tf - | List a compressed archive. |
sha256sum F > F.sha256 | Publish a checksum next to a file. |
ln -s F latest | Stable name pointing at the current version. |
Quiz
(Module 1) You are in `/root/lab/project`. Where does `cd ../..` take you?
- `/root/lab`
- `/root`
- `/`
- `/root/lab/project/..`, which is an error
(Module 2) `docs` is an existing directory. What does `mv report.txt docs` do?
- Renames report.txt to a file called docs, destroying the directory
- Moves report.txt into docs/
- Fails because docs exists
(Module 3) Which line saves both normal output and errors of `cmd` into `all.log`?
- `cmd 2>&1 > all.log`
- `cmd > all.log 2>&1`
- `cmd | all.log`
(Module 3) What does `cut -d: -f1 /etc/passwd | sort | uniq -c | sort -rn | head -3` show?
- The three most frequent values of the first field, with their counts
- The first three lines of /etc/passwd
- The three longest user names
(Module 4) Which command prints the lines of `app.conf` that are neither comments nor blank?
- `grep '^#' app.conf`
- `grep -v '^#' app.conf | grep -v '^