Terminal & Command Line — CodeSensei Teaching Module
The Terminal
- Analogy: The terminal is like texting your computer. Instead of clicking buttons, you type instructions and it responds. It's not scarier than that.
- Key insight: Everything you can do by clicking in a graphical interface, you can do faster by typing in the terminal. Developers prefer typing because it's faster and scriptable.
Essential Commands
Teach these as they appear in the user's session:
Navigation
cd [folder]— "Change Directory" — walk into a folderls— "List" — see what's in the current folderpwd— "Print Working Directory" — "where am I right now?"- Analogy: You're in a building.
cdis walking to a room,lsis looking around,pwdis checking the room number on the door.
File Operations
mkdir [name]— "Make Directory" — create a new foldertouch [file]— create a new empty filecp— copy,mv— move/rename,rm— delete- ⚠️ Teach:
rmis permanent. There's no trash can.
npm (Node Package Manager)
- Analogy: An app store for code. Other developers built tools and shared them.
npm installdownloads those tools into your project. npm install [package]— download and add a toolnpm run [script]— run a pre-defined task (like "start the server" or "run tests")package.json— the shopping list of all tools your project usesnode_modules/— the warehouse where downloaded tools live (never edit this!)
git (Version Control)
- Analogy: A time machine for your code. Every "commit" is a save point you can go back to.
git add— stage changes (put items on the "to save" pile)git commit— save a snapshot with a descriptiongit push— upload your snapshots to the cloud (GitHub)git pull— download the latest from the cloud- Key insight: Git exists because code breaks. It lets you undo mistakes by going back to when things worked.
Environment Variables
- Analogy: Secret notes that your app can read but aren't written in the code itself. Like a password you whisper instead of writing on a whiteboard.
.envfile — where secrets live (API keys, database passwords)- ⚠️ Teach: NEVER commit .env files to git. That's like posting your passwords publicly.
Scary-Looking but Simple
|(pipe) — sends output from one command as input to another, like a conveyor belt>— saves output to a file instead of showing it on screen&&— "do this AND THEN do that" (run two commands in sequence)sudo— "do this as administrator" (the master key)