Skip to content

Phase 3 · Free

Lab: Phase 3, Learn to Talk to Your Machine

Use only the terminal to build a folder tree, search it, edit a report, restore a file, and commit your course notes.

Cost: $0. Tools: your Ubuntu VMA software-based emulation of a complete computer that runs its own operating system and applications, isolated from the host hardware. Read more →, terminalThe window or screen where you type text commands and read their output, connected to a shell that runs those commands. Read more → only. No file manager for this whole lab.

Steps

  1. Build ~/company/ with folders hr, engineering, sales, finance, it, each holding 3 .txt files. One command can do it: mkdir -p ~/company/{hr,engineering,sales,finance,it} then touch ~/company/{hr,engineering,sales,finance,it}/file{1..3}.txt. Explain in your notes what the braces did.
  2. Put at least one line of text in every file using echo and >.
  3. Copy the whole tree to /tmp/company-backup.
  4. find every .txt file in ~/company. Save the output.
  5. grep -r for a word you put in some files. Save the output.
  6. Run df -h and free -h into system-report.txt.
  7. Open system-report.txt in nano or vim and add a first line: System Report - <today's date>.
  8. Back up /etc/hosts, add a test entry, prove it with pingA tool that checks whether another device on a network is reachable and how long the round trip takes. Read more →, restore the backupA copy of data stored separately from the original, used to restore systems and files after data loss from hardware failure, deletion, ransomware, or disaster. Read more →, prove with diff that it is back.
  9. git init in ~/course-notes, add everything, commit “initial commit - phases 1-3”.

Worked troubleshooting: the folders were not created where you expected

Symptom. You ran step 1, but cat company/hr/file1.txt says:

cat: company/hr/file1.txt: No such file or directory

Hypothesis. Two common causes. You are in a different folder than you think, or the shell did not expand ~ and the braces because they were inside quotes.

Test. pwd shows where you are. Then look for a folder literally named ~. On the course VM, running the step 1 command with the path in double quotes from /tmp gave this:

mkdir -p "~/company/{hr,it}"
ls /tmp/~
company

The shell created a folder called ~ in the current folder, with one folder inside literally named {hr,it}. Quotes turn off tilde and brace expansion.

Fix. Remove the wrong folder with care (rm -r "/tmp/~", quoted, so ~ is not expanded to your home folder), then rerun the command from step 1 without quotes.

Why it worked. Expansion is done by the shell before mkdir runs. mkdir did exactly what it was told; the shell just told it something different.

Proof (~/course-notes/phase-3-cli/)

  • commands-reference.md: every command from this phase, what it does, one example, in your own words.
  • text-editor-notes.md: your editor, its keys, mistakes you made.
  • git-reference.md: your commit workflow.
  • challenge-notes.md: exact commands and output for steps 1 to 9.
  • git log --oneline output pasted at the end.

Done when

Every step is in challenge-notes.md with real output, and git log shows your commit.