The Terminal & Command Line
Module 4: The Terminal & Command Line
Tier 1: Foundations | Estimated time: 2–3 hours | Prerequisites: Modules 1–3
What You'll Get Out of This
The terminal is the text-based interface to your computer. It's how you run Git commands (Module 5), execute Python scripts (Modules 12–13), install packages, and navigate projects. Most PM courses skip the terminal entirely, and people hit a wall the moment instructions say "run this command."
Fifteen minutes of comfort here prevents hours of frustration later. And your AI tool has a cheat code: you can ask it to write terminal commands for you.
Part 1: What the Terminal Is
You already use a graphical interface to interact with your computer — clicking folders, dragging files, opening applications. The terminal does all of the same things, but with typed commands instead of mouse clicks.
Why does it still exist? Two reasons:
- It's faster for certain tasks. Renaming 50 files, moving a folder, installing a package, running a script — one command vs. many clicks.
- Many developer tools only work through the terminal. Git, Node.js, Python, package managers — they're all terminal-first tools. There's no way around this.
Opening the Terminal
In Cursor: Use
Ctrl+`(backtick, the key above Tab) or View → Terminal. A panel appears at the bottom.
In Claude Code: You're already in the terminal — Claude Code runs directly in it. Just open your system terminal (Terminal app on Mac, PowerShell on Windows) and navigate to your project folder.
Windows note: Windows ships with both PowerShell and Command Prompt. Use PowerShell — it supports more commands and is what Cursor opens by default.
What You're Looking At
You'll see something like:
ethan@macbook my-first-app %
or on Windows:
PS C:\Users\ethan\my-first-app>
This is the prompt (different from an AI prompt). It tells you:
- Who you are (
ethan) - What computer you're on (
macbook) - What folder you're currently in (
my-first-app)
The blinking cursor after it is where you type commands.
Part 2: Essential Commands
You need about 10 commands for this entire course. Here they are.
Navigating
pwd — Print Working Directory. Shows you where you are.
$ pwd
/Users/ethan/projects/my-first-app
ls — List. Shows what's in the current folder.
$ ls
index.html style.css script.js README.md
On Windows, dir does the same thing as ls, but ls usually works too if you installed Git Bash.
cd — Change Directory. Move to a different folder.
$ cd projects # Go into the "projects" folder
$ cd .. # Go up one level (back to parent folder)
$ cd ~ # Go to your home folder
$ cd ~/projects/my-app # Go to a specific path
Quick tip: Press Tab while typing a folder name and the terminal will auto-complete it. Type cd pro then Tab → it becomes cd projects/.
Creating Things
mkdir — Make Directory. Create a new folder.
$ mkdir my-new-project
touch — Create an empty file (Mac/Linux). On Windows PowerShell, use New-Item filename.
$ touch notes.md
Moving and Copying
cp — Copy a file.
$ cp index.html backup.html
mv — Move (or rename) a file.
$ mv old-name.html new-name.html # Rename
$ mv file.html ../other-folder/ # Move to another folder
Deleting
rm — Remove a file. Be careful — there's no trash can. It's gone.
$ rm unwanted-file.html
rm -r — Remove a folder and everything inside it. Use with caution.
$ rm -r old-project
Running Programs
node — Run a JavaScript file.
$ node script.js
python3 — Run a Python file (use python on Windows).
$ python3 process.py
git — Run Git commands (you'll learn these in Module 5).
$ git status
Viewing File Contents
cat — Print a file's contents to the terminal.
$ cat README.md
Stopping Things
Ctrl+C — Stop whatever's running. If a process is stuck or you want to cancel, press Ctrl+C. This is the "get me out of here" command.
Part 3: AI-Assisted Terminal Commands
Here's why AI coding tools make the terminal dramatically less intimidating: you can ask the AI to write commands for you.
In Cursor: Press Cmd+K (Mac) or Ctrl+K (Windows) in the terminal. A text input appears — type what you want in plain English.
In Claude Code: You're already in a conversational terminal. Just describe what you want — "list all HTML files in this folder and its subfolders" — and Claude Code will run the right command for you. No special shortcut needed.
For example, asking "List all HTML files in this folder and its subfolders" generates:
find . -name "*.html"
You can review it before running. This means you never need to memorize obscure commands — you just need to describe what you want.
Try these:
- "Show me the 10 largest files in this folder"
- "Count how many lines are in each JavaScript file"
- "Create a folder called 'backup' and copy all CSS files into it"
- "Find all files modified in the last 24 hours"
Use AI-assisted commands liberally. Over time, you'll start remembering the common commands naturally.
Part 4: Terminal Patterns You'll Use Repeatedly
The "Navigate and Run" Pattern
This is the most common terminal workflow in the course:
$ cd my-project # Go to your project folder
$ ls # See what's there
$ python3 script.py # Run a script
The "Install and Run" Pattern
For JavaScript projects that use packages:
$ npm install # Install all dependencies listed in package.json
$ npm start # Run the project
For Python projects:
$ pip install -r requirements.txt # Install all dependencies
$ python3 main.py # Run the project
The "Check and Fix" Pattern
When something isn't working:
$ pwd # Am I in the right folder?
$ ls # Do I see the files I expect?
$ node --version # Is Node.js installed?
$ python3 --version # Is Python installed?
Nine times out of ten, "it's not working" means you're in the wrong folder. pwd and ls are your diagnostic tools.
Part 5: Terminal Fluency Tips
Use the Up Arrow
Press the up arrow key to cycle through your previous commands. If you just ran a command and want to run it again (or modify it slightly), up arrow is faster than retyping.
Clear the Screen
If the terminal gets cluttered:
$ clear
Or press Ctrl+L to clear the terminal screen.
Multiple Terminals
You can have multiple terminal tabs. In Cursor, click the + icon in the terminal panel. Useful when you want one terminal running a server and another for commands.
Don't Panic About Permissions
If you see "Permission denied" when installing npm packages globally, check the Troubleshooting Guide for fixing npm permissions properly rather than using sudo.
On Windows, right-click your terminal and select "Run as administrator" if you encounter permission issues.
Lab: Terminal Navigation Exercise
Complete these 10 tasks using only the terminal (no mouse file browser). Time yourself — the goal is comfort, not speed.
- Open your terminal
- Navigate to your home folder (
cd ~) - Create a folder called
terminal-practice - Navigate into it
- Create three files:
notes.md,data.csv,script.py - List the files to confirm they exist
- Create a subfolder called
backup - Copy
notes.mdinto thebackupfolder - Navigate into
backupand verify the file is there - Navigate back to
terminal-practiceand delete thebackupfolder
If you get stuck on any step, ask your AI tool for help.
Lab: npm from Scratch
Run these commands in order to experience the JavaScript package ecosystem:
$ mkdir npm-test && cd npm-test
$ npm init -y # Creates a package.json
$ npm install cowsay # Installs a fun package
$ npx cowsay "Hello from npm!" # Runs the package
You should see an ASCII cow saying your message. This is trivial, but the pattern — npm install then npx or npm start — is how every JavaScript project works.
Lab: Reading Terminal Errors
Try running a command that doesn't exist:
$ thiswontwork
You'll see something like: thiswontwork: command not found
Now try:
$ node nonexistent-file.js
You'll see: Error: Cannot find module '/path/to/nonexistent-file.js'
Practice reading these errors. The terminal is telling you exactly what's wrong — a missing command vs. a missing file. This is the same pattern you'll see with real errors.
Bonus: Terminal in Context
Navigate to your Module 1 project folder and:
- List all files
- View the contents of
index.htmlusingcat - Count the number of lines in the file:
wc -l index.html - Open the file in your browser from the terminal:
open index.html(Mac) orstart index.html(Windows)
Go Deeper
Once the basics feel natural, try these in the terminal:
history— shows every command you've run in this session. Useful for retracing your steps.cat file1.md file2.md > combined.md— combine two files into onegrep "search term" filename.md— search inside a file for specific text- Ask your AI tool: "Show me the 5 largest files in this folder sorted by size"
If You Get Stuck
"command not found": You're either misspelling the command or the program isn't installed. Try which node or which python3 to check if the program exists on your system. If it returns nothing, the program isn't installed or isn't in your PATH.
You're in the wrong folder: Run pwd (where am I?) and ls (what's here?). These two commands orient you instantly. If you're not where you expect, use cd ~ to go home, then navigate from there.
Terminal looks frozen: The program might still be running. Press Ctrl+C to cancel it. If that doesn't work, close the terminal tab and open a new one.
Commands from the module don't work on Windows: Some commands differ between Mac/Linux and Windows PowerShell. cat → Get-Content, open → start, touch → New-Item. When in doubt, ask your AI tool in plain English — it generates the right command for your operating system.
Checkpoint
You've completed Module 4 when:
- You can open the terminal in your AI tool without looking up how
- You completed the 10-task navigation exercise
- You can navigate to any folder on your computer using
cd - You can list files, create folders, and create files from the terminal
- You've used AI in the terminal to generate at least 3 commands you didn't know
- When something isn't working, your first instinct is to check
pwdandls
What's Next
You can navigate your project from the terminal. Now it's time to learn the most important tool you'll run from it: Git. Module 5 teaches version control — how to save, track, branch, merge, and collaborate on your work like a professional.
Previous: ← Module 3: How Code Actually Works Next: Module 5: Version Control with Git →