Stage 2 · Lesson 2 of 9
Creating, copying, moving and deleting
A handful of do most of the daily work. mkdir -p creates folders, including any missing parent folders. touch creates an empty file.
cp copies, mv moves or renames, and rm deletes. Add -r to cp or rm to work on whole folders. The shell has no recycle bin: rm deletes straight away.
So check the path first, and run ls with the same pattern to see exactly what would be removed. Also note that mv overwrites a file with the same name without asking, unless you add -i. Scripts and servers use these same commands.
Common traprm -rf with a variable or a typo in the path, which can delete far more than you meant.
A question to check yourself, an AI practice session and 1 cheat sheet entry come when you add the roadmap to your account. Add it
Resources for this stage
Start with· follow one of these
- CourseFreeThe Missing Semester of Your CS Education
MIT · Beginner
MIT's lectures on the shell and shell tools, with exercises after each one
- BookFreeThe Linux Command Line
William Shotts · Beginner
A free book that explains the shell step by step; the first part covers this whole stage
Practise
Keep handy
Also worth your time
- roadmap.sh: Shell / BashGo deeper
The full map of shell and Bash topics, to see what comes after the basics