Part One
Creating — touch and mkdir
You already know mkdir from Chapter 1. Let us look at both creation commands together.
mkdir (make directory) creates a new, empty folder. Give it the name you want:
mkdir sources
mkdir 2026-03-04_city_hall_documents
If you try to create a directory that already exists, mkdir will give you an error. That is intentional — the terminal never overwrites silently.
touch creates an empty file. If the file already exists, it updates the file's timestamp without changing its content. It is often used to create placeholder files before filling them in a text editor:
touch interview_2026-03-04.txt
touch analysis.py
After touch, the file exists but is empty. You then open it in VS Code (or any editor) and fill in the content.
$
Try: mkdir data_journalism → ls → cd data_journalism → touch notes.txt → mkdir sources → ls
Part Two
mv — Moving and Renaming
mv stands for move. It has two uses that at first seem different but are actually the same operation:
Moving a file to another directory:
This takes interview_notes.txt from Downloads and places it inside Files/data_journalism. The original is gone — mv does not make a copy.
Renaming a file:
This renames notes.txt to vocabulary.txt in the same directory. Moving a file within the same folder is renaming it. That is why mv handles both.
mv works on directories too:
mv will overwrite it without warning. Double-check your paths before moving. Use ls to verify source and destination before running mv.
$
Try: ls Downloads → mv Downloads/interview_notes.txt Files/data_journalism/ → ls Files/data_journalism
Part Three
cp — Copying Files
cp stands for copy. It works just like mv, except the original file stays where it was. After cp, you have two copies: the original and the new one at the destination.
This copies data_raw.csv from Downloads into data_journalism. The original in Downloads is untouched.
You can also copy and rename in the same step by giving the destination a different name:
This creates a copy called data_clean.csv in the same directory. A common pattern: copy the original before cleaning it, so you always have the raw data to fall back on.
cp when you want to keep the original in place — for example, backing up raw data before processing it. Use mv when you want to reorganise or rename without duplication.
$
Try: cp Downloads/data_raw.csv Files/data_journalism/data_raw.csv → ls Files/data_journalism → ls Downloads (original still there?)
Part Four
rm and rmdir — Deleting
rm stands for remove. It deletes a file permanently. There is no Trash, no undo. The file is gone.
rmdir removes a directory — but only if it is completely empty. This is a safety feature: the terminal will refuse to silently delete a folder that still has content.
If the directory is not empty, you will get an error: Directory not empty. You must first remove the files inside before you can remove the folder.
rm -rf (remove, recursive, force) deletes a directory and everything inside it — instantly and permanently. Never run it unless you are absolutely certain. There are countless stories of developers accidentally running rm -rf / and wiping an entire system. In the sandbox it is disabled for safety. In real life, treat it with great caution.
$
Try: ls → rm draft_one.txt → rm draft_two.txt → rmdir empty_folder → ls · Try: rmdir sources (will it work?)
Part Five
Practice — A Journalism Workflow
You have just received two files in your Downloads folder: a raw CSV dataset and a set of interview notes. Your task is to organise them into a proper project structure using only terminal commands.
The target structure you are building:
├── data/
│ └── air_quality.csv
└── notes/
└── interview_2026-03-04.txt
Steps to complete:
- Navigate into
Files/data_journalism - Create two new directories:
dataandnotes - Copy
data_raw.csvfrom Downloads intodata/and rename itair_quality.csv - Move
interview_notes.txtfrom Downloads intonotes/and rename itinterview_2026-03-04.txt - Verify the structure with
ls dataandls notes
$
Goal: build Files/data_journalism/data/ and Files/data_journalism/notes/ with the right files inside
touch creates empty files; mkdir creates directories; mv moves and renames files and folders; cp copies files while leaving the original intact; rm deletes files permanently and rmdir removes empty directories. In Chapter 4 you will learn to read and search inside files without ever opening a text editor.
Chapter Navigation
Move between chapters.