🖥️ A Gentle, Hands-On Guide
🎯 What You Will Learn
By the end of this guide, you’ll be able to:
- Understand what the terminal is
- Navigate folders (directories)
- Create, move, rename, and delete files
- Read file contents
- Use basic power tools (
ls,cd,pwd,mkdir,rm,cp,mv) - Understand absolute vs. relative paths
- Use
helpand man pages - Understand how commands, flags, and arguments work
🌱 SECTION 1 — What Is the Command Line?
The command line (terminal) is a place where you tell your computer what to do using text commands instead of clicking buttons.
You can open it by:
- Mac: Applications → Utilities → Terminal
- Windows: Windows Terminal / Command Prompt / PowerShell
- Linux: Ctrl+Alt+T
We will use general commands that work on macOS & Linux.
If you're on Windows and want the same commands, install Git Bash or use WSL. See the guide below.
🪟 Note for Windows Users — Install Git Bash First
Windows’ default terminals (Command Prompt, PowerShell) use different commands from macOS/Linux.
To make learning simpler, we’ll use Git Bash, which supports the same commands as macOS/Linux.
👉 Install Git Bash Here:
Choose “Windows” → Install with default settings.
After installation, open:
Git Bash
From here on, all commands in this guide will work the same whether you are on:
✔ Windows (Git Bash)
✔ macOS (Terminal)
✔ Linux (Terminal)
🧠 Mini Quiz
- Is the terminal a graphical or text-based interface?
- Do you “click” commands or type them?
- What do you open on macOS to access the terminal?
📍 SECTION 2 — Your First Commands
🧪 Activity: Try Your First Commands
1. See where you are
pwd
Means print working directory.
You’ll see something like:
/Users/yourname
2. List what’s in this folder
ls
3. Move into a folder
cd Desktop
4. Move back
cd ..
5. Go to your home folder
cd ~
🧠 Mini Quiz
- What command shows your current location?
- How do you go “up” one folder?
- What does
~represent?
📁 SECTION 3 — Files and Folders (Create, List, Explore)
Create a folder
mkdir test-folder
Move into it
cd test-folder
Create a file
Different OS options:
macOS / Linux:
touch notes.txt
Windows PowerShell:
ni notes.txt
Now check:
ls
View file contents
cat notes.txt
(It will be empty; that’s fine.)
🧪 Activity: Build a Mini Workspace
Run these commands:
mkdir projects
cd projects
mkdir project1
cd project1
touch index.html
touch script.js
cd ..
mkdir project2
Then explore with:
ls
cd project1
ls
pwd
🧠 Mini Quiz
- What command creates a folder?
- What command creates a file?
- How do you view the content of a file?
🧭 SECTION 4 — Paths (Absolute vs Relative)
Absolute path
A full address:
/Users/yourname/Desktop
Relative path
Based on where you are:
cd ../other-folder
🧪 Activity: Path Scavenger Hunt
- Run
pwd - Use only
cd ..to climb back to your home folder - Use absolute path to jump to Desktop
- Use relative path to return to home
Try examples:
cd /Users/<yourname>/Documents
Then:
cd ../Downloads
🧠 Mini Quiz
- Which is shorter: relative or absolute paths?
- Do absolute paths always start with
/? - What does
..mean?
🛠 SECTION 5 — Moving, Copying, Renaming, Deleting
⚠️ These commands are powerful. Practice on test files only.
Rename a file
mv oldname.txt newname.txt
Move a file
mv notes.txt Documents/
Copy a file
cp notes.txt notes-copy.txt
Delete a file
rm notes-copy.txt
Delete a folder (careful!)
rm -r test-folder
🧪 Activity: File Manipulation Challenge
Inside a temporary folder:
- Create 3 files
- Rename one
- Copy one
- Move one into a new folder
- Delete one
🧠 Mini Quiz
- Which command removes files?
- What flag do you need to delete folders?
- Which command is used for renaming AND moving?
🧩 SECTION 6 — Understanding Command Syntax
Commands typically follow this pattern:
command [options/flags] [arguments]
Examples:
ls -l
ls -a
rm -r foldername
Where:
- command = program to run
- flags = change behavior
- arguments = what to run it on
🧪 Activity: Experiment with Flags
Try:
ls -l
ls -a
ls -la
Observe the differences.
🧠 Mini Quiz
- Which part is the flag in
ls -a? - Does the order of flags matter?
- What are arguments?
🔍 SECTION 7 — Finding Help
Every command has built-in help.
man pages (macOS/Linux)
man ls
Scroll with arrow keys, exit with q.
help flag
ls --help
🧪 Activity: Explore 3 Commands
Run:
man pwd
man mkdir
man rm
Or:
pwd --help
🧠 Mini Quiz
- What command shows manual pages?
- How do you quit a man page?
- What flag often displays help?
📦 SECTION 8 — Practical Daily Workflow
Here’s a realistic flow you’ll use constantly:
pwd
ls
cd foldername
ls
cat somefile.txt
cd ..
mkdir newfolder
mv file.txt newfolder/
rm oldfile.txt
Practice this every day and your comfort will skyrocket.
🧪 FINAL EXERCISE — Build & Manage a Folder Tree
Step 1 — Create a structure
mkdir school
cd school
mkdir math english science
cd math
touch algebra.txt geometry.txt
Step 2 — Navigate around
cd ../english
touch essay1.txt
Step 3 — Manipulate
mv ../math/geometry.txt .
cp essay1.txt essay1-copy.txt
rm ../science
Try exploring the entire tree with:
ls -R
🎉 You’re Ready!
You can now:
- Navigate the terminal
- Create and manage files and folders
- Understand paths
- Use flags
- Find help
- Build and manage folder structures
- Work comfortably in a development environment
Top comments (0)