Linux, terminal and Git

Stage 2 · Lesson 2 of 9

Creating, copying, moving and deleting

Shell basics

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

Practise

  • A game played over SSH where each level needs a new command, from `ls` to finding hidden files

Keep handy

  • Paste any command and see what each part does before you run it

  • Short, example-first help pages for common commands when a man page is too long

Also worth your time

Mark this stage as not done?