The terminal in 10 minutes
Lesson 10 of 26 in the course “Vibe coding”. Free, with animations and a quiz.
What the terminal is
The terminal is a window where you control your computer by typing commands instead of clicking. On Mac and Linux it's called Terminal; on Windows it's PowerShell or the Command Prompt. Sounds like a hacker movie, but it's simple. Why you care: agents and many coding tools work right there. And you need to understand what they run on your computer.
cd and ls: where am I
The terminal is always “standing” in some folder. The cd command, from change directory, moves you to another one: cd my-site enters the my-site project folder. The ls command lists the files in the current folder. In the old Windows Command Prompt you type dir instead of ls. The $ sign in the picture means the terminal is waiting for a command; you don't type it.
npm install: get the libraries
A library is a ready-made piece of code from other people, say for a calendar or nice buttons. Projects usually use dozens of libraries. npm is a package manager, a program that downloads them. It comes with Node.js, a program that runs JavaScript outside the browser. npm install reads the project's list of libraries and downloads them into the node_modules folder. Nobody edits that folder by hand.
npm run dev and localhost
npm run dev starts the site on your own computer so you can see changes before publishing. Most projects have this command. The terminal prints an address like localhost:3000. localhost means “this very computer”, and 3000 is the port number, like the number of the door the site waits behind. Another project may use another number. Open the address in your browser. To stop it: Ctrl+C, on a Mac too (Ctrl, not Cmd).
Dangerous commands
The terminal does exactly what's written, with no recycle bin and no “are you sure?”. For example, rm -rf deletes a folder with everything inside, for good. So don't paste commands from strangers in videos and chats unless you understand every word. And don't type keys or passwords into the terminal: it keeps a history of commands, and the secret stays there in plain text.
The agent asks permission
Agents usually ask before running a command: “Allow npm install?”. This is your producer moment. If you understand the command, allow it. If not, don't hit “yes” on autopilot: ask the agent “what does this command do and what will it change?”. A good agent will explain in plain words. Check commands that delete files or touch your keys extra carefully.
Check yourself
- You ran npm run dev. Where do you see the site?
Correct answer: In the browser at localhost with the port. localhost means your own computer. Only you can see the site for now; it isn't on the internet yet. - How do you stop a site running in the terminal?
Correct answer: Press Ctrl+C in the terminal. Ctrl+C stops the running program, on a Mac too. rm -rf doesn't stop anything; it deletes files for good. - An agent asks to run a command you don't understand. What do you do?
Correct answer: Ask the agent what it does. You're the producer and responsible for your computer. First understand what the command will change, then allow it.