Cyberlium

Linux › Module 2 › Lesson 4

BeginnerModule 2Lesson 4/5

Lab — Terminal Practice

Hands-on lab: build a mini project folder from the command line

25 min+24 XP3 quiz
Module progress4 of 5

Opening

Reading commands is not a lab. Building ~/cyberlium-lab is.

You now have navigation (pwd, ls, cd, mkdir), file operations (cp, mv, rm, cat/less/head), and editors (nano/vim save and quit). This lesson chains them into one project on YOUR machine. Security work is folder hygiene: evidence here, notes there, backups named on purpose. You will build $HOME/cyberlium-lab as that habit — not as a CTF flag hunt, and not as rm -rf / "cleanup." If you cannot build a tidy tree under your home directory, you are not ready to touch /etc.

1. What you are building and why it lives in $HOME

The project is a tiny incident-notes layout: a working directory, a notes file you wrote, a backup copy, and an archive/ folder. That pattern shows up in real investigations (working copy vs preserved copy). It belongs under $HOME because Module 1 put user files in /home, not in /, /etc, or /tmp. /tmp can vanish on reboot. /etc is configuration. / is the entire tree.

Name things on purpose: notes.txt is the living document; notes.bak or archive/notes-copy.txt is the freeze. If you only ever have one file and you edit it forever, you cannot answer "what did we know at 14:00?" Version discipline starts with cp, not with Git — though Git comes later in real jobs.

Isolation is part of the lab design. Everything you create should be deletable with rm -ri on that folder alone. If your "lab" sprawls into Downloads, Desktop, and /opt, you will eventually rm the wrong relative path. One root folder under $HOME is a blast-radius control.

2. Mechanics: mkdir -p, relative paths, and verify loops

mkdir -p $HOME/cyberlium-lab/archive creates parents as needed and does not fail if the directory exists. cd into the lab, pwd to confirm, then create notes with nano or echo. cat the file. cp notes.txt archive/notes.bak. ls -la both locations. The verify loop (do, then ls/cat) is how professionals catch typos before mv/rm.

Relative paths are power tools: from inside cyberlium-lab, archive/notes.bak is clear. Absolute paths are safer in scripts and when you are lost: $HOME/cyberlium-lab/notes.txt. If pwd surprises you, stop inventing ../.. chains — pwd, then cd to a known absolute place. Guessing with .. is how people leave home and edit /.

mv renames or relocates; rm deletes. For this lab, prefer cp for the backup, keep the original, and only rm throwaway scratch files you created seconds ago. Interactive rm -i is a training wheel worth keeping while you build muscle memory. Never practice rm -rf / or rm -rf /* — not even "as a joke" on a machine without a snapshot.

3. Quality bar: what done looks like

Done means: cyberlium-lab exists; notes.txt has at least three lines you wrote; archive/ holds a copy; ls -la shows both; you can explain which file is working vs preserved. Bonus: a short README.txt describing the layout. Not done: files scattered in /, sudo mkdir under /opt for homework, or "I deleted it to clean up" with no copy.

Permissions preview (Module 3): keep the lab owner-writable; do not chmod 777 the tree. If you cannot write in your own home directory without sudo, fix the environment — do not sudo every mkdir forever. Daily sudo for home files is a smell.

Ethics: only your VM, WSL, or spare machine. Do not build the lab in a shared account's home. Do not "organize" someone else's Desktop with mv. Terminal skills without boundaries become vandalism.

Timebox the lab: twenty focused minutes of mkdir/cp/ls beats two hours of decorating filenames. If nano feels awkward, use a short heredoc like the code block below — the skill is path discipline, not editor fandom. When you finish, leave the tree in place; later modules will drop scripts and fake logs into the same cyberlium-lab root so your notes compound instead of scattering.

4. Wrong vs right: project hygiene vs destructive cleanup

Failure mode — same commands, opposite outcomes. Right builds under $HOME and verifies:

  • Wrong

    mkdir /lab as root, dump notes in /tmp, skip backups, then rm -rf * from the wrong directory because pwd was /. Or chmod 777 -R /home to "stop permission errors." Or follow a meme command that formats a disk. Curiosity does not require destroying the only copy of your work.

  • Right

    mkdir -p $HOME/cyberlium-lab/archive, write notes.txt, cp a backup into archive/, verify with pwd/ls/cat, keep rm pointed only at throwaways you created, and leave / and /etc alone. Snapshot the VM if you want a safety net. End the lab with a tree you could show an instructor without shame.

5. Practical: build the mini project

Type these on your machine. After mkdir and cp, run the verify commands even if you feel sure. The lab grades habits, not speed.

Command guide

Safe cyberlium-lab mini project (your machine only)

YOUR VM / WSL / spare Linux only

Command — copy this

mkdir -p "$HOME/cyberlium-lab/archive"
cd "$HOME/cyberlium-lab" || exit 1
pwd

Command — copy this

cat > notes.txt << 'EOF'
Cyberlium lab notes
- working copy lives here
- backups go under archive/
EOF

Command — copy this

cp -v notes.txt archive/notes.bak
ls -la
ls -la archive/
cat notes.txt
cat archive/notes.bak

optional README

Command — copy this

echo "Layout: notes.txt = working; archive/ = preserved copies" > README.txt

NEVER:

Optional command

rm -rf /
mkdir /cyberlium-lab   # stay under $HOME
chmod -R 777 /

Mission: show the tree

1) Create $HOME/cyberlium-lab/archive on your own Linux shell. 2) Write notes.txt with at least three lines; copy it to archive/notes.bak. 3) Run pwd, ls -la, and cat on both files; keep the outputs in mind (or paste into a second notes file). 4) One sentence: why the lab lives under $HOME instead of /tmp or /.

Stuck? Ask Cyberlium AI Mentor

If cd or cp fails, ask Cyberlium AI Mentor for a hint — not a full remote-control script. Try: "Hint only: cp says No such file — should I check pwd or create archive/ first?" No spoilers; run ls yourself.

You now have a real lab home: folders, a working note, a preserved copy, and a verify habit. Module 2's commands only matter when they build something you can trust. Next up — Quiz — Basic Commands — checks navigation and file ops without the folder in front of you.

Knowledge Check

1

APPLY: You meant to backup notes.txt into archive/ but pwd shows /tmp and ls has no archive. Best move?

Multiple choice

Knowledge Check

2

APPLY: Why keep both notes.txt and archive/notes.bak instead of only editing one file forever?

Multiple choice

Knowledge Check

3

APPLY: True or False: Building ~/cyberlium-lab well means you may organize another user's home with mv on a shared lab PC without asking.

True or False

← Previous

Answer all 3 knowledge checks to continue. (0/3 answered)