Guides ·
CLI 101: the terminal for people who'd rather not
A CLI (command-line interface) is just a way to tell your computer what to do by typing instead of clicking. Lots of dev tools only come as CLIs, so at some point a setup guide will say "open your terminal". This is for that moment
Open the terminal
- Mac: press
Cmd + Space, type Terminal, hit Enter - Windows: open the Start menu, type PowerShell, hit Enter
- Linux: you already know
You'll see a line ending in $ or >. That's the prompt. It's waiting for you
How a command is shaped
Every command is the same pattern: the program, then options (called flags), then what you want it to act on
ls -la Documentsls is the program (list files), -la are flags (show everything, as a list), and Documents is the folder. Most tools tell you their flags if you add --help
The 10 commands you'll actually use
pwd: where am I right nowls: what's in this folder (diron Windows)cd folder: go into a folder.cd ..goes back upmkdir name: make a foldercp a b: copy a filemv a b: move or rename a filecat file: print a fileclear: clean up the screen- Up arrow: bring back your last command
Ctrl + C: stop whatever's running
One to be careful with: rm deletes files with no trash bin and no undo. Double-check the path before you hit Enter
Installing a CLI tool
Most tools install with a package manager, which is an app store for the terminal. Which one depends on the tool's docs:
# Mac
brew install gh
# anything built with Node.js
npm install --global vercel
# check it worked
gh --versionIf the version prints, you're done. If you get "command not found", close the terminal and open a new one, then try again
API keys and secrets
Tools often need a key. Set it as an environment variable instead of pasting it into commands, where it ends up saved in your history:
export MY_API_KEY="paste-it-here"That lasts until you close the terminal. For a project, keys usually go in a .env file that never gets committed to git
When you're stuck
- Read the actual error. The useful line is usually the last one
- Add
--helpto the command - Copy the error into a search engine, minus any keys or personal paths