HAP at a terminal, focused and curious

Station 1: The Agent Does Something Mysterious

Your first real look at what happens in the terminal

Welcome to Station 1! I had VS Code open, Copilot in Agent Mode, and it was fixing a bug I had reported. Terminal commands were flying — lines I had never typed, doing things I did not understand. I was clicking "Accept" on every single one.

Then the approval prompt appeared again, and for the first time, I stopped. I did not click. I read it. I had no idea what it meant.

Prof. Teeters walked by, glanced at my screen, and said one thing: "Good. You finally stopped." Then she kept walking.

That was the moment everything changed. Let me show you what I learned next... 🟠

Quick Reference

Terminal Navigation and Files →

Before we start: Make sure your terminal is ready.

  • Windows: Open the VS Code terminal and click the dropdown arrow next to the + button. Select Git Bash (two words, capital G capital B). Do not see Git Bash? Install Git for Windows first, then restart VS Code.
  • Mac: Your terminal defaults to zsh. No changes needed.

All commands in this lab work in both bash and zsh. Every example I show will look the same on either system.

Asking Copilot to Explain Itself

After Prof. Teeters walked away, I decided to do something I had never done before. Instead of asking Copilot to fix my code, I asked it to explain what it had been doing. Here is that conversation:

HAP: I was told agents use the terminal and I need to understand that. I can do npm install and npm run dev but not a lot.

Copilot: Great question! When I work in Agent Mode, I run shell commands in a real terminal session — the same terminal you see in VS Code. Here is what that means:

  • Shell commands: I type commands like ls, cd, mkdir, and cat — the same commands any developer would type by hand.
  • Persistent sessions: When I cd into a directory, I stay there. Environment state carries forward from one command to the next, the same way it does when you type manually.
  • Run, inspect, react: I run a command, read the output, and decide what to do next based on what the terminal tells me. If there is an error, I adapt.

Think of it this way: I am not doing anything magical. I am typing commands into the same zsh session you have open, reading what comes back, and making decisions.

(I found out later that Copilot actually runs in its own terminal session, not the one I had open. But the commands themselves were the same — that part was true.)

That last line stuck with me: "I am not doing anything magical." The commands were not secret. They were learnable. I decided to learn them.

HAP robot looking confused while reading a treasure map

Where Am I? — pwd

After reading Copilot's explanation, I muttered out loud: "But where is the terminal even pointing? How do I know what folder it is looking at?"

Grace Hopper, without turning around:

"Type pwd. It will tell you exactly where you are. That is always the first question."

I typed it:

pwd

And the terminal responded with something like:

/Users/hap/projects/my-website

pwd stands for "print working directory." It does not change anything. It does not move you anywhere. It answers one question: where am I right now?

I learned from Prof. Teeters that this is the command you type when you are lost, when you are unsure, when something feels wrong. It costs nothing and tells you everything you need to orient yourself.

A Correction from Grace

I was re-reading Copilot's explanation when Grace spoke again. She had been listening the whole time.

Grace Hopper, still not turning around:

"Copilot said 'zsh session.' The shell depends on your environment. On Windows with Git Bash, you are running bash. Do not assume. Type echo $0 if you want to know which shell is running right now."

She was right. Copilot had said "the same zsh session" — but that is only true on a Mac. On Windows with Git Bash, the shell is bash. The commands we are learning work in both, but Grace wanted me to understand: do not repeat something an agent tells you without verifying it. 😳

What Is Here? — ls

Now I knew where I was. The next question: what is in this location?

ls

This lists the files and folders in your current directory. When I ran it inside my project folder, I saw familiar names — src, package.json, node_modules. The same files I could see in the VS Code sidebar.

But ls by itself hides things. Files that start with a dot (like .gitignore) do not show up. To see everything, including hidden files and details like file sizes:

ls -la

The -l flag means "long format" — more detail per file. The -a flag means "all" — including hidden files. When I was practicing, I ran ls -la and discovered files I had never noticed in the sidebar. They had been there the whole time.

Moving Around — cd

cd stands for "change directory." It moves the terminal's focus from one folder to another.

cd src

After running that, I typed pwd again to confirm:

pwd
/Users/hap/projects/my-website/src

I was inside src now. Here are the three variations I use constantly:

cd ..        # Go up one level (back to the parent folder)
cd ~         # Go to your home directory, no matter where you are
cd -         # Go back to wherever you just were

The cd .. pattern is the one I reach for most. Two dots means "the folder above this one." One dot means "this folder." That distinction matters.

HAP robot in scientist mode with lab equipment

The Experiment: Terminal and Sidebar, Same Room

I wanted to prove to myself that the terminal and the VS Code sidebar were looking at the same place. So I ran a sequence:

pwd
cd src
pwd
ls
cd ..
pwd

Every time I ran cd, I followed it with pwd to confirm where I landed. And every time, the files I saw with ls matched what the VS Code sidebar showed for that folder. The sidebar did not follow me around — it stayed on whatever I had last clicked. But the files were the same files.

Same room. Same files. The terminal is not a separate world — it is another window into the same project. I kept using pwd as my checkpoint between every move until it became automatic.

Creating Things — mkdir and touch

Navigating is one skill. Creating is another. These two commands let you build the structure of a project from the terminal.

mkdir — make a directory

mkdir components

This creates a new folder called components inside whatever directory you are currently in. That is why pwd matters before you create anything — you need to know where the folder will appear.

touch — create a file

touch index.html

This creates an empty file. It does not open it. It does not put anything inside it. It creates it and moves on. If the file already exists, touch updates its timestamp without changing its contents.

I used both together to build a small folder structure:

mkdir practice-project
cd practice-project
mkdir css js
touch index.html css/style.css js/app.js
ls

When I ran ls, I saw css, js, and index.html — exactly the structure I intended. And the VS Code sidebar updated in real time to show it.

The Moment It Clicked

I went back to Copilot and asked it to fix another bug. This time, I watched the terminal commands it ran. And I could read them.

HAP with an explosion of understanding

The Breakthrough:

"The agent was not conjuring files. It was using the same five commands I had learned. The commands did not change. I did."

I had been approving a language I could not read. Now I can read it. The command did not change. I did.

🟠 And with that came a new habit: pwd first. ls to confirm. Read the command. Then approve.

Mistakes I Made Along the Way

This was not a smooth journey. Here are three things that tripped me up while I was learning:

HAP surrounded by broken code with an embarrassed expression

HAP's Confession:

  • I typed mkdir my project and got two folders — one called my and one called project. Spaces split arguments. Use quotes (mkdir "my project") or hyphens (mkdir my-project).
  • I tried to cd into a folder that did not exist. The terminal gave me an error: No such file or directory. It is not gentle. In most setups, it does not guess what you meant.
  • I ran touch notes.txt and then could not find the file anywhere. I had not checked where I was with pwd, and I had not confirmed with ls. The file existed — in the wrong directory.

HAP's Five-Command Cheat Sheet

1

pwd — Where am I?

Prints the full path to your current directory. Use it before creating files, after changing directories, and whenever you feel lost.

2

ls — What is here?

Lists files and folders in your current location. Add -la to see hidden files and details. Always run after pwd to confirm what you are working with.

3

cd — Move somewhere

Changes your working directory. Use cd .. to go up, cd ~ for home, and cd - to go back. Always follow with pwd until it becomes automatic.

4

mkdir — Create a folder

Makes a new directory inside your current location. Watch out for spaces in names — use hyphens or quotes instead.

5

touch — Create a file

Creates an empty file. Does not open it or add content. Run pwd first so you know where the file will land.

Next station we go deeper — not navigating, but working with files. And learning why the terminal has no undo.

HAP waving goodbye

Quick Reference

Terminal Navigation and Files →