M11 - File System Lab: Mini Scenario

Use navigation, reading, creating, moving, searching, and archiving together to clean up a safe practice project from the terminal.

File System

File System Lab: Mini Scenario

Use navigation, reading, creating, moving, searching, and archiving together to clean up a safe practice project from the terminal.

30 min INTERMEDIATE BOTH
What you should learn
  • Use navigation, reading, creating, moving, searching, and archiving together to clean up a safe practice project from the terminal.
Visual model

Concept to practice path

Each lesson is meant to move from an idea, to an example, to a safe practice step.

The Goal

This lab is not about speed. It is about doing a small sequence correctly.

You will work in a safe practice folder, inspect what is there, organize it, confirm one hidden setting, search for one note, and archive the result.

Practice Rule

Stay inside the folder created for this exercise. Do not point these commands at real project directories until the sequence feels routine.


Step 1: Create the Practice Folder

Create the Lab Folder

cd $env:USERPROFILE mkdir -Force TerminalPractice\incoming cd TerminalPractice\incoming New-Item -ItemType File -Path index.html, style.css, notes.txt, todo.log New-Item -ItemType File -Path .env -Value "MODE=staging" Add-Content -Path .\notes.txt -Value "archive after cleanup"

Create the Lab Folder

cd ~ mkdir -p TerminalPractice/incoming cd TerminalPractice/incoming touch index.html style.css notes.txt todo.log printf "MODE=staging\n" > .env echo "archive after cleanup" >> notes.txt


Step 2: Complete the Cleanup

Work inside incoming and complete these tasks in order.

Task 1: Survey the folder

List the directory contents and make sure you can see the hidden .env file.

Task 2: Create structure

Create these folders:

  1. site
  2. docs
  3. logs

Task 3: Move files intentionally

  • move index.html and style.css into site
  • move notes.txt into docs
  • move todo.log into logs

Task 4: Read the hidden config

Read .env without opening a GUI editor. What value is set for MODE?

Task 5: Search one file

Find the line containing the word archive inside the notes file.

Task 6: Archive the cleaned project

Step out to the parent directory and create a single archive of TerminalPractice.


Suggested Solution

Task 1

Survey the Folder

Get-ChildItem -Force

Survey the Folder

ls -la

Task 2 and Task 3

Create Structure and Move Files

mkdir site, docs, logs Move-Item index.html, style.css -Destination .\site
Move-Item notes.txt -Destination .\docs
Move-Item todo.log -Destination .\logs\

Create Structure and Move Files

mkdir site docs logs mv index.html style.css ./site/ mv notes.txt ./docs/ mv todo.log ./logs/

Task 4 and Task 5

Read and Search

Get-Content ..env Select-String -Path .\docs\notes.txt -Pattern "archive"

Read and Search

cat ./.env grep "archive" ./docs/notes.txt

Task 6

Archive the Folder

cd .... Compress-Archive -Path .\TerminalPractice -DestinationPath .\TerminalPractice.zip

Archive the Folder

cd ../.. tar -czvf TerminalPractice.tar.gz ./TerminalPractice


Move On When

You can do this lab with only occasional command lookup, and you can explain why you inspected before moving and searched before assuming.

That is the real skill from this section: careful terminal work, not theatrical terminal work.

Learning loop

Recall it, check it, then practice it.

Do this before moving on. It turns reading into memory and safer action.

Recall
  • If someone gave you a messy folder, what sequence would you follow before moving or deleting anything?
  • Which commands from the file-system block would you use first, and why?
Check
  • Complete the scenario without using the mouse and without losing any files.
  • Explain how you verified the folder was clean before archiving it.

What to do next

Best next step Practice

Use the matching lab or keep building skill in practice.

Open now