Skip to Content
GuidesTerminal essentials

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

CommandWhat it doesExample
pwdPrint where you are right nowpwd/Users/nick/projects/my-app
lsList files and folders herels → shows src/ package.json README.md
ls -laList everything including hidden files, with detailsShows .env, .git/, file sizes
cd folderMove into a foldercd src
cd ..Go up one levelFrom /src/components to /src
cd ~Go to your home directoryFrom anywhere to /Users/nick
cd -Go back to where you just wereToggles between last two locations

Files and folders

CommandWhat it doesExample
mkdir nameCreate a foldermkdir components
touch fileCreate an empty filetouch .env.local
cp source destCopy a filecp .env.example .env.local
mv old newMove or renamemv old-name.tsx new-name.tsx
rm fileDelete a file (no undo!)rm temp.txt
rm -rf folderDelete a folder and everything in it (careful!)rm -rf node_modules

Running things

CommandWhat it doesExample
npm installInstall project dependenciesRun in your project root
npm run devStart the dev serverOpens your app at localhost:3000
Ctrl + CStop a running processKills the dev server
clearClear the terminal screenJust 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 vercel

The -g flag installs it system-wide, not just in your project.

“I need to see if something is running on a port”

lsof -i :3000

Shows 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 it
  • permission denied → try sudo or check file permissions
  • EADDRINUSE → 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. Use history | grep "search term" to find one.
  • Copy/paste — in Mac terminal: Cmd+C to copy, Cmd+V to paste. In most terminals, right-click also works.
  • 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.