Terminal essentials
The terminal (also called command line, shell, or CLI) is a text interface to your computer. It looks intimidating but you only need a handful of commands to be effective. AI tools like Cursor will often ask you to run commands — this guide makes sure you understand what’s happening.
Opening the terminal
- Mac:
Cmd + Space→ type “Terminal” → Enter. Or use the terminal inside Cursor/VS Code (Ctrl + ~). - Windows: Search “PowerShell” or use Windows Terminal. Inside Cursor:
Ctrl + ~. - In Cursor: The integrated terminal is at the bottom of the editor. Your AI assistant can run commands here directly.
The 15 commands you actually need
Navigation
| Command | What it does | Example |
|---|---|---|
pwd | Print where you are right now | pwd → /Users/nick/projects/my-app |
ls | List files and folders here | ls → shows src/ package.json README.md |
ls -la | List everything including hidden files, with details | Shows .env, .git/, file sizes |
cd folder | Move into a folder | cd src |
cd .. | Go up one level | From /src/components to /src |
cd ~ | Go to your home directory | From anywhere to /Users/nick |
cd - | Go back to where you just were | Toggles between last two locations |
Files and folders
| Command | What it does | Example |
|---|---|---|
mkdir name | Create a folder | mkdir components |
touch file | Create an empty file | touch .env.local |
cp source dest | Copy a file | cp .env.example .env.local |
mv old new | Move or rename | mv old-name.tsx new-name.tsx |
rm file | Delete a file (no undo!) | rm temp.txt |
rm -rf folder | Delete a folder and everything in it (careful!) | rm -rf node_modules |
Running things
| Command | What it does | Example |
|---|---|---|
npm install | Install project dependencies | Run in your project root |
npm run dev | Start the dev server | Opens your app at localhost:3000 |
Ctrl + C | Stop a running process | Kills the dev server |
clear | Clear the terminal screen | Just tidies up |
Understanding what you see
nick@macbook my-app %This is your prompt. It tells you: who (nick), where (my-app folder), and the % (or $) means it’s ready for input.
When you run a command and nothing prints, that usually means it worked. Unix tools are quiet on success.
The concepts that matter
Path — the address of a file or folder. /Users/nick/projects/my-app/src/page.tsx is an absolute path. src/page.tsx is a relative path (relative to where you are now).
Home directory (~) — your user folder. ~/Desktop means /Users/nick/Desktop.
Hidden files — files starting with . (like .env, .gitignore). They exist but ls won’t show them unless you add -a.
Environment variables — values set in your shell session. When docs say “set your API key,” they often mean add it to .env.local and your framework loads it automatically.
Pipes (|) — send the output of one command into another. ls | grep "test" lists files then filters for ones containing “test”. You’ll rarely write these yourself but AI assistants use them.
sudo — run as admin. If a command fails with “permission denied,” you might need sudo command. Be careful — sudo can change system files.
Common situations
“I need to install something globally”
npm install -g vercelThe -g flag installs it system-wide, not just in your project.
“I need to see if something is running on a port”
lsof -i :3000Shows what’s using port 3000. Kill it with kill PID (the number in the output).
“I need to find a file”
find . -name "*.tsx"Finds all .tsx files starting from the current directory.
“A command just failed” Read the error message — it usually says what’s wrong. Common fixes:
command not found→ you need to install itpermission denied→ trysudoor check file permissionsEADDRINUSE→ another process is using that port
Tips
- Tab completion — start typing a file/folder name and press
Tab. The terminal will auto-complete it. - Up arrow — cycles through your previous commands. Way faster than retyping.
history— shows your recent commands. Usehistory | grep "search term"to find one.- Copy/paste — in Mac terminal:
Cmd+Cto copy,Cmd+Vto paste. In most terminals, right-click also works.
Related
- Git & GitHub — version control commands you’ll use alongside these
- Editor & AI — the integrated terminal in your editor
- Deployment — where terminal commands meet hosting
Last reviewed: April 2026.