Students make folders, copy, move, rename and delete files (rm and rm -r) and save text with echo and >, learning that rm has no recycle bin (AC9TDI10K01 node 1).
Load these into Waypoints Prepare: choose Load URL and paste the copied address, or download the file and import it. In Prepare, the worksheet's Teacher edition shows the answers; the student copy hides them.
SlidesDownload Present from the browser, or export to PowerPoint or PDF.
WorksheetDownload Print the student copy; the Teacher edition has the answers.
Students will be able to
I can make folders and copy, move and rename files.
I can delete files and folders, knowing it is for good.
I can save text into a file.
Timing
Predict and Try 7 min · Worked example 10 min · Vary 10 min · Practise and Make 13 min
Before class
Try the boards yourself.
The one idea: these commands change the filesystem, and rm is permanent. Real servers have no bin; backups are how people recover.
The pretend mv and cp take one file and one destination.
Running the lesson
Predict: students who said the bin will meet the empty ls in the Try.
Worked example: ask how many copies exist after cp, and after mv.
Vary: ask why rm refuses a folder without -r.
Make: compare routes: three commands or one?
The hard part (on purpose)
The Make has more than one route; students who try one big mv and get pictures/photos inside should look at the tree and fix it, not start again.
When students get stuck
What you will see
A question to ask
The fix
A student expects to undo rm (Sam's mistake).
Where would the file have gone? Is there a bin folder?
rm is final; copy first.
A student's > emptied a file.
What's the difference between > and >>?
> replaces; >> adds to the end.
Answers to the checks
after rm: You type rm notes.txt. Where is notes.txt now? Gone. rm deletes straight away; the bin on your laptop is something the desktop adds, not the operating system.
Try: back it up, then delete: Make a folder called old, copy notes.txt into it, then delete the notes.txt in your home folder.
mkdir old, cp notes.txt old, rm notes.txt. The copy in old is the only one left: rm really deletes.
Five commands that change things: You type mv pets.txt photos. Then ls in your home folder. Is pets.txt there? No: mv moved it into photos mv moves (one file, new place); cp copies (two files).
Find the mistake: Sam deletes a file. Click the line where it first goes wrong. line 3 Line 3: rm has no recycle bin. The file is gone; copy anything you might need first.
Renaming: How do you rename notes.txt to todo.txt? mv notes.txt todo.txt Moving a file to a new name in the same folder renames it.
Rename: Rename notes.txt to todo.txt.
mv notes.txt todo.txt: same file, new name.
Make a file: Make a file called hello.txt that says hello, using echo and >.
echo hello > hello.txt. Careful: > replaces whatever was in the file.
Remove a folder: Delete the photos folder and both photos in it, with one command.
Back up first: You want to try editing report.txt but keep the original safe. What first? cp report.txt report-backup.txt Copy first; then you can always go back.
Replace or add: echo hi > notes.txt. What happens to what was in notes.txt? It's replaced by hi > replaces the file's contents; >> adds to the end.
Review: hidden: Review: how do you see hidden files? ls -a -a for all.
tidy up: Tidy up: both photos should end up in a new folder called pictures inside projects, and the old photos folder should be gone.
mkdir, mv, mv, rm -r. Or, before making pictures, one command: mv photos projects/pictures moves and renames the whole folder.
Solutions
One possible solution for each task. Other correct programs are fine.
Vary: one change each › Rename
Open task: any program that does what the step asks.
Vary: one change each › Make a file
Open task: any program that does what the step asks.
Vary: one change each › Remove a folder
Open task: any program that does what the step asks.
tidy up
Open task: any program that does what the step asks.
Stretch and support
Stretch: Make a folder called backups and copy every .txt file in your home folder into it, one cp at a time. How would a script do it?
Support: Add to the card: mkdir, cp a b, mv a b, rm a, rm -r folder, echo text > file.
Exit ticket
What is the difference between cp notes.txt old and mv notes.txt old? Which is safer before deleting?
cp leaves the original and makes a copy in old; mv moves it. cp is safer.
What each step is for
after rm: Committing to where a deleted file goes tests the new move: rm deletes for good.
Try: back it up, then delete: Making a backup before deleting settles the prediction and uses mkdir, cp and rm in a safe order.
Worked example: cp or mv?: Comparing cp and mv on the same file models the new move: copy keeps the original, move doesn't. Sam expects a recycle bin, the misconception planted after the method.
Vary: one change each: Each task changes one thing: renaming with mv, making a file with echo and >, then removing a whole folder with rm -r.
safely: Choosing the safe command is the same move in mixed forms, plus a review of hidden files.
tidy up: Reorganising folders to match a description reverses the process: from the tidy result wanted to the commands that make it.