Terminal Basics
The terminal Terminal / CLI A text-based interface used to give commands to your computer. It's how you talk to the machine directly. "Like texting your computer instead of using apps. Type what you want, hit enter, get results. No buttons, just conversation."
What is a Terminal?
Think of the terminal as texting your computer. Instead of clicking buttons, you type short commands. Your computer reads them and does exactly what you asked.
Every developer uses it. Git, npm, deployment tools—they all run in the terminal. Once you know the basics, you'll wonder why you ever avoided it.
The Vibe Coder Reality
Claude Code Claude Code Anthropic's agentic coding tool. It lives in your terminal (and in VS Code, JetBrains, and on the web), reads your codebase, edits files, runs commands, and ships code. Install with the native installer (`curl -fsSL https://claude.ai/install.sh | bash` on macOS/Linux, `irm https://claude.ai/install.ps1 | iex` on Windows); it needs a Pro, Max, Team, Enterprise, or Console account. "Like having a senior developer living in your terminal, ready to help 24/7."ls from a scary rm -rf. It also helps you start Claude in the right folder.
Opening the Terminal
🍎 Mac
Press Cmd + Space, type "Terminal", hit Enter.
Or use iTerm2 for a better experience.
🪟 Windows
Press Win + R, type "cmd" or "powershell".
Windows Terminal (built into Windows 11) is the nicest option. Using WSL? Open the Ubuntu profile and every Mac/Linux command on this page works as-is.
VS Code Tip
Press Ctrl + ` (backtick) to open the integrated terminal in VS Code or Cursor. Most developers live here, often with Claude Code running in one tab and npm run dev in another.
Commands You'll Actually Use
pwd — Where am I?
Print Working Directory. Shows the full path to your current folder. Use this when you're lost.
$ pwd
/Users/yourname/projects/my-app
ls — What's here?
List. Shows all files and folders in your current directory. Add -la to see hidden files and details.
$ ls
node_modules package.json src README.md
$ ls -la
.env.local .git .gitignore node_modules ...
Windows Note
On Windows CMD, use dir instead of ls. PowerShell supports both.
cd — Move around
Change Directory. Navigate into folders. Use .. to go up one level.
# Go into a folder
cd my-project
# Go up one level
cd ..
# Go to home directory
cd ~
# Go to a specific path
cd /Users/yourname/Desktop
mkdir — Create a folder
Make Directory. Creates a new folder.
# Create a new folder
mkdir my-new-project
# Create nested folders
mkdir -p src/components/ui
touch & rm — Create and delete
touch creates empty files. rm deletes them. Be careful with rm—there's no trash can!
# Create a new file
touch index.js
# Delete a file
rm old-file.js
# Delete a folder and everything in it
rm -rf folder-name # DANGEROUS!
Warning
rm -rf deletes forever. No confirmation, no recovery. Double-check before running.
clear — Clean slate
Clears the terminal screen. Doesn't delete anything—just tidies up.
clear
# Or press Ctrl + L (same thing)
Keyboard Shortcuts That Save Time
| Shortcut | What it does |
|---|---|
| Tab | Auto-complete file/folder names |
| ↑ / ↓ | Cycle through command history |
| Ctrl + C | Cancel current command |
| Ctrl + L | Clear the screen |
| Ctrl + A | Jump to start of line |
| Ctrl + E | Jump to end of line |
| Ctrl + R | Search command history |
Tab is Your Best Friend
Start typing a folder name and press Tab—the terminal auto-completes it. No more typos!
Quick Reference
| Command | What it does |
|---|---|
| pwd | Print current directory |
| ls | List files |
| ls -la | List all files with details |
| cd folder | Go into folder |
| cd .. | Go up one level |
| mkdir name | Create folder |
| touch file | Create empty file |
| rm file | Delete file |
| clear | Clear screen |
| code . | Open VS Code here |
Reading Commands Before You Approve Them
When Claude Code wants to run a command, it can show it to you first (depending on your permission mode). A quick gut-check guide:
Usually safe
ls, pwd, cat, git status, git diff, npm run dev, npm run build
Read it first
npm install <pkg>, git commit, git push, npx <anything>
Stop and ask why
rm -rf, sudo, git push --force, git reset --hard, piping a download straight into bash
Not sure what a command does? Ask Claude "explain that command before running it." And commit with Git often, so even a bad command is recoverable. For the bigger picture on AI safety rails, see Prompt Injection & Security.
Common Pitfalls
"Command not found"
Usually means the program isn't installed, or you're in the wrong directory.
Fix: Check spelling. Make sure you've installed the tool (npm, git, etc.). Try running which command-name to see if it exists.
"Permission denied"
You're trying to do something that requires admin access.
Fix: For genuine system tasks on Mac/Linux, sudo runs a command as admin (on Windows, run the terminal as Administrator). Be careful—sudo gives full access. Never use sudo with npm; if npm complains about permissions, install Node through a version manager instead (see Setup Your Workspace).
"I'm in the wrong folder"
Commands only work in the right context. Running npm install outside your project folder won't work.
Fix: Run pwd to see where you are. Use cd to navigate to your project folder.
"The command is stuck"
Some commands (like servers) run forever until you stop them.
Fix: Press Ctrl + C to cancel and get your prompt back.
Ready for version control?
Now that you can navigate the terminal, learn Git Git A version control system that tracks changes to your code. It lets you save snapshots, undo mistakes, and collaborate with others. "Like Google Docs history on steroids. You can see every change ever made and go back in time."