- 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?
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 Lab: Mini Scenario
Use navigation, reading, creating, moving, searching, and archiving together to clean up a safe practice project from the terminal.
- Use navigation, reading, creating, moving, searching, and archiving together to clean up a safe practice project from the terminal.
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
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"
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:
sitedocslogs
Task 3: Move files intentionally
- move
index.htmlandstyle.cssintosite - move
notes.txtintodocs - move
todo.logintologs
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
Get-ChildItem -Force
ls -la
Task 2 and Task 3
mkdir site, docs, logs
Move-Item index.html, style.css -Destination .\site
Move-Item notes.txt -Destination .\docs
Move-Item todo.log -Destination .\logs\
mkdir site docs logs mv index.html style.css ./site/ mv notes.txt ./docs/ mv todo.log ./logs/
Task 4 and Task 5
Get-Content ..env Select-String -Path .\docs\notes.txt -Pattern "archive"
cat ./.env grep "archive" ./docs/notes.txt
Task 6
cd .... Compress-Archive -Path .\TerminalPractice -DestinationPath .\TerminalPractice.zip
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.
Recall it, check it, then practice it.
Do this before moving on. It turns reading into memory and safer action.
- Complete the scenario without using the mouse and without losing any files.
- Explain how you verified the folder was clean before archiving it.
Review again after 1, 3, 7 days.
What to do next
Best next step PracticeUse the matching lab or keep building skill in practice.