Essential Commands
What you'll learn
~18 min- Create files and folders with touch and mkdir
- View file contents with cat
- Copy, move, and rename files with cp and mv
- Delete files and folders safely with rm
- Combine commands into real workflows
By the end of this lesson, you will be able to create, read, copy, move, rename, and delete files entirely from the terminal. These six commands, combined with the three navigation commands from the last lesson, give you everything you need for day-to-day file management.
This lesson assumes a Bash-compatible shell (macOS Terminal, Linux, WSL, or Git Bash on Windows). If you’re on Windows without WSL, some commands like touch may not work in PowerShell or Command Prompt.
The mental model: a desk with drawers
Think of the terminal as sitting at a desk:
- mkdir = adding a new drawer (creating a folder)
- touch = putting a blank sheet of paper in a drawer (creating a file)
- cat = picking up a sheet and reading it
- cp = photocopying a sheet (the original stays)
- mv = moving a sheet to a different drawer (or writing a new label on it)
- rm = permanently deleting a sheet (no recycling bin)
Your toolkit
In the last lesson you learned to navigate (pwd, ls, cd). Now you’ll learn to do things — create folders, create files, move them around, and read their contents.
Here are the six commands you need:
| Command | What it does | Memory trick |
|---|---|---|
mkdir | Create a new folder | Make Directory |
touch | Create a new empty file | ”Touch” a file into existence |
cat | Display file contents | Concatenate (show) |
cp | Copy a file or folder | Copy |
mv | Move or rename a file | Move |
rm | Delete a file | Remove |
Practice terminal
Use this simulator to follow along with every exercise below. It has a pre-built filesystem so you can experiment freely.
Creating things
mkdir — Make a directory (folder)
mkdir my-projectThis creates a new folder called my-project in your current directory. Think of it as clicking “New Folder” in your file explorer.
Avoid spaces in folder and file names. Use hyphens (my-project) or underscores (my_project) instead. Spaces in names require special handling in the terminal and cause problems later.
touch — Create an empty file
touch notes.txtThis creates an empty file called notes.txt. If the file already exists, it updates its “last modified” timestamp (hence the name “touch” — you’re just touching it).
Reading things
cat — Show file contents
cat notes.txtThis prints the contents of notes.txt to your screen. It’s how you quickly peek at what’s inside a file without opening an editor.
Try reading a file in the simulator above — run cat documents/notes.txt from your home directory to see what’s in it.
🧬In Your Field: Biotechclick to expand
cat is particularly useful for quickly checking data files before processing them. For example, before running an analysis script on a CSV file, you might run cat sample-data.csv to verify the headers and first few rows look right. For larger files, there are commands like head (shows the first 10 lines) and tail (shows the last 10 lines) — but cat is fine for quick checks on smaller files.
Moving and copying things
cp — Copy a file
cp original.txt backup.txtThis creates a copy of original.txt named backup.txt. The original stays untouched — just like photocopying a document.
cp notes.txt documents/notes.txtThis copies notes.txt into the documents folder.
mv — Move (or rename) a file
mv has two uses — it both moves and renames files. The syntax is the same either way:
Move a file to a different location:
mv notes.txt documents/notes.txtRename a file (move it to a new name in the same location):
mv old-name.txt new-name.txtBoth mv and cp will silently overwrite an existing file at the destination. Always ls the destination first to make sure you won’t lose an important file.
If you’re keeping the same file name, you only need to specify the destination folder: cp notes.txt documents/ or mv notes.txt documents/.
A helpful way to remember: mv is like cut-and-paste, while cp is like copy-and-paste.
Deleting things
rm — Remove a file
rm notes.txtThis permanently deletes notes.txt. There is no trash can. There is no undo.
Unlike dragging a file to the Trash, rm doesn’t have an undo. The file is gone immediately. Always double-check what you’re deleting. When in doubt, use ls first to make sure you’re deleting the right file.
To delete a folder and everything inside it:
rm -r my-folderThe -r flag means “recursive” — delete the folder and all its contents. Think of it as emptying a drawer and then removing the drawer itself.
Before running rm -r, always ls the folder first to see what’s inside. A good safety habit: run ls my-folder before rm -r my-folder. This takes two seconds and can save you from deleting the wrong thing.
🏛️In Your Field: Government / State Devclick to expand
In government environments, data retention policies often require that files be preserved for specific periods. Be especially careful with rm on shared servers — deleted files cannot be recovered without backups, and some environments don’t have automated backups for user directories. When in doubt, mv files to an archive folder instead of deleting them. You can always clean up the archive later after confirming nothing important is inside.
Worked example: setting up a project from scratch
Here’s a realistic workflow — the kind of thing you’ll do regularly when starting a new project with an AI CLI tool:
# Step 1: Create the project folder and go insidemkdir my-websitecd my-website
# Step 2: Create the main filestouch index.htmltouch style.csstouch app.js
# Step 3: Create subdirectories for organizationmkdir imagesmkdir data
# Step 4: Verify the structurels# app.js data images index.html style.css
# Step 5: Check where we arepwd# /home/user/my-websiteIn just a few commands, you’ve created a basic project structure. When you use AI CLI tools later, they’ll do this for you automatically — but understanding what they’re doing gives you power and confidence.
Common patterns
Here are patterns you’ll use all the time:
Create a project and move into it (one line):
mkdir project-name && cd project-nameThe && means “and then” — create the folder, then move into it. The second command only runs if the first succeeds.
Check before you delete:
ls my-folder # See what's inside firstrm -r my-folder # Then delete if you're sureCopy a whole folder:
cp -r my-project my-project-backupThe -r (recursive) flag works with cp too — it copies the folder and everything inside.
Create multiple files at once:
touch file1.txt file2.txt file3.txtYou can pass multiple filenames to touch in a single command.
Practice challenge
Try this sequence in the simulator above, starting from /home/user:
- Create a new folder called
experiment - Navigate into it
- Create three files:
data.csv,analysis.py,README.md - Go back to your home directory (hint:
cd ..to go up one level, orcd ~to go home) - Copy the entire
experimentfolder toexperiment-backup - Verify both folders exist with
ls
📊In Your Field: MIS / Businessclick to expand
MIS professionals often need to organize reports, datasets, and configuration files across multiple projects. A common pattern is to create a standardized folder structure for each quarter’s analysis: mkdir q1-2026 && cd q1-2026 && mkdir raw-data cleaned-data reports. AI CLI tools can generate these structures for you from a description, but knowing how to do it manually means you can always verify and adjust what the AI creates.
What does the command `mv report.txt archive/report.txt` do?
You want to delete a folder called 'old-data' and everything inside it. Which command is correct?
When Things Go Wrong
Use the Symptom → Evidence → Request pattern: describe what you see, paste the error, then ask for a fix.
Quick reference
| I want to… | Command | Example |
|---|---|---|
| Create a folder | mkdir folder-name | mkdir reports |
| Create a file | touch filename.txt | touch notes.txt |
| Read a file | cat filename.txt | cat notes.txt |
| Copy a file | cp source dest | cp data.csv backup.csv |
| Copy a folder | cp -r source dest | cp -r project project-bak |
| Move/rename a file | mv old new | mv draft.txt final.txt |
| Delete a file | rm filename | rm old-data.csv |
| Delete a folder | rm -r folder | rm -r temp-files |
Key takeaways
- Six commands handle all file operations:
mkdir,touch,cat,cp,mv,rm. cpis copy-and-paste.mvis cut-and-paste.rmis the shredder (no undo).- Always
lsbeforermto verify you’re deleting the right thing. - Use
-r(recursive) when working with folders:cp -rto copy folders,rm -rto delete folders. - You now know 9 core terminal commands (
pwd,ls,cd,mkdir,touch,cat,cp,mv,rm). That’s genuinely enough to use any CLI tool effectively.
🔍What about editing files from the terminal?
You might wonder: touch creates empty files and cat reads files — but how do you edit a file? There are terminal-based text editors like nano (beginner-friendly) and vim (powerful but steep learning curve). However, for this course, you’ll use VS Code for editing, which gives you a familiar visual editor. When you launch an AI CLI tool like Claude Code, it can create and edit files for you — so you rarely need to manually edit files in the terminal. If you ever need a quick edit, nano filename.txt opens a simple editor where you can type, save with Ctrl+O (then press Enter to confirm the filename), and exit with Ctrl+X.
What’s next
You now have the full set of essential terminal commands. In the next lesson, we’ll set up your working environment — VS Code, remote connections, and cloud alternatives — so you have the right cockpit for everything that follows.