You’ve probably copy-pasted a terminal command before. It worked — or it didn’t — and either way it felt like magic you didn’t control. That ends here. The terminal is not magic. It’s a text interface to your computer, and once it clicks, you’ll wonder how you ever worked without it.
Every server on the planet — cloud instances, HPC clusters, Docker containers, CI/CD pipelines — is operated this way. No GUI. Just a shell. This lesson gets you comfortable in that world from day one.
What Is a Terminal Emulator vs. a Shell?
These two terms get confused constantly. They’re different things.
A terminal emulator is the window you type in. It’s a program (like Terminal.app on Mac, GNOME Terminal on Linux, or Windows Terminal on Windows). It’s just the interface — the glass.
A shell is the program running inside that window. It interprets your commands and talks to the OS. The most common shells are:
- bash — Bourne Again Shell. The default on most Linux servers and older Macs. This is what you’ll use on any remote machine.
- zsh — Z Shell. The default on modern macOS. More features, same core commands.
- fish — Friendly Interactive Shell. Nice for beginners on personal machines, but rare on servers.
Key takeaway: Learn bash. It’s everywhere. zsh commands are 99% identical. Fish is different enough to cause confusion on servers.
Check which shell you’re running:
echo $SHELL
You’ll see something like /bin/bash or /bin/zsh.
Setting Up Your Environment
Windows users: You need WSL2 (Windows Subsystem for Linux). This gives you a real Ubuntu Linux environment inside Windows — no VM needed.
# Run this in PowerShell as Administrator
wsl --install
Restart, then open “Ubuntu” from the Start menu. You’re now in a real Linux shell.
Mac users: Open Terminal (Cmd + Space, type “Terminal”). You’re already there.
Linux users: Open your terminal app. You know who you are.
Basic Navigation
The shell starts you in your home directory (~). Think of it as your personal folder — /home/yourname on Linux or /Users/yourname on Mac.
These are the commands you’ll use every single day:
pwd # Print working directory — "where am I right now?"
ls # List files in current directory
ls -la # List all files (including hidden) with details
cd Documents # Change directory into Documents
cd .. # Go up one level
cd ~ # Go back to home directory
cd - # Go back to where you just were (super useful)
Tip: Tab completion is your best friend. Type the first few letters of a file or directory name and press Tab. The shell autocompletes it. If there are multiple matches, press Tab twice to see them all.
Creating and Managing Files
mkdir projects # Create a directory
mkdir -p projects/sim/results # Create nested directories at once
touch notes.txt # Create an empty file
cp notes.txt notes_backup.txt # Copy a file
mv notes.txt renamed.txt # Rename (or move) a file
rm renamed.txt # Delete a file (no trash — gone for good)
rm -r old_folder/ # Delete a directory and everything in it
cat notes_backup.txt # Print file contents to terminal
less largefile.txt # Scroll through a large file (q to quit)
Warning: rm is permanent. There is no recycle bin in the terminal. Double-check before you run rm -r on anything.
Absolute vs. Relative Paths
An absolute path starts from the root of the filesystem (/). It works from anywhere:
cd /home/alice/projects/sim
A relative path starts from where you currently are:
cd projects/sim # Only works if you’re in /home/alice
cd ../data # Go up one level, then into data
Use pwd any time you’re lost. Use absolute paths in scripts so they work regardless of where you run them.
Wildcards & Globbing
ls *.csv # All .csv files in current directory
ls results_?.txt # results_1.txt, results_2.txt, etc. (? = one char)
rm *.log # Delete all log files (be careful!)
cp data/*.csv output/ # Copy all CSVs from data/ into output/
The find command is more powerful for searching:
find . -name "*.py" # Find all Python files from here down
find /var/log -name "*.log" -mtime -7 # Logs modified in last 7 days
Use tree (install it if needed) to visualize directories:
tree projects/
# projects/
# ├── sim
# │ └── results
# └── notes_backup.txt
Try It Yourself
Build a project folder structure from scratch using only the terminal.
- Open your terminal (or WSL2 on Windows)
- Create a directory called
engineering-projectin your home folder - Inside it, create three subdirectories:
data,scripts, andresults - Create an empty file called
README.txtin the root ofengineering-project - Create a file called
run.pyinsidescripts/ - Use
treeorls -Rto verify the structure looks right - Copy
README.txtinto theresults/folder
Expected result:
engineering-project/
├── README.txt
├── data/
├── results/
│ └── README.txt
└── scripts/
└── run.py
Quiz
What is the difference between a terminal emulator and a shell?
- A) They are the same thing — both terms refer to the command-line window
- B) The terminal emulator is the window/UI; the shell is the program interpreting your commands
- C) The shell is the window; the terminal emulator runs inside it
- D) bash is the terminal emulator; zsh is the shell
Answer
B) The terminal emulator is the window/UI; the shell is the program interpreting your commands.
The terminal is just the glass — the window you type in. The shell (bash, zsh, fish) is the actual program that reads your input, interprets it, and runs commands. You can run different shells inside the same terminal emulator.