Agent Code Academy
Home/Phase 1: Foundation
Week 1 of 12

The Terminal & File System

Your gateway to Claude Code

Objective

Master command-line navigation, file management, and install Node.js.

Deliverable

A `my-first-project` folder (with subfolders) created entirely from the terminal, and Node.js installed and verified.

Topics

  • What is a terminal and why we use it
  • Opening the terminal on Mac, Windows, and Linux
  • Navigation commands: pwd, ls, cd
  • File management commands: mkdir, touch, cp, mv, rm
  • Reading files: cat, less, head, tail
  • Environment basics: echo, export, PATH
  • Installing Node.js and npm
  • Package managers: Homebrew (Mac)

Activities

  • Open the terminal for the first time and type `pwd` to see where you are
  • Navigate to your home directory (`cd ~`) and explore with `ls`
  • Create your first project folder: `mkdir my-first-project`
  • Inside `my-first-project`, create subfolders: `mkdir notes`, `mkdir scripts`
  • Create, move, copy, and delete practice files to build muscle memory
  • Install Node.js using Homebrew (Mac) or nvm (any platform)
  • Verify installation with `node --version` and `npm --version`

Skills You'll Gain

Terminal navigation, file management, reading error messages, Node.js setup


Learning Objectives

By the end of this week, you will be able to:

  1. Open a terminal on your operating system and explain what it does
  2. Navigate the file system using pwd, ls, and cd
  3. Create, copy, move, and delete files and folders from the command line
  4. Read file contents using cat, less, head, and tail
  5. Install Node.js and verify the installation with version commands

Lesson

What Is a Computer? (The 30-Second Version)

A computer has two parts: hardware (the physical machine — screen, keyboard, processor, memory) and software (the instructions that tell the hardware what to do). Every app you use — your web browser, your music player, your calculator — is software. When you write code, you are writing software.

What Is a File System?

Every computer organizes information in a tree structure, like folders inside folders. Picture it like this:

/  (root — the very top)
├── Users/
│   └── yourname/         ← your "home" folder
│       ├── Desktop/
│       ├── Documents/
│       ├── Downloads/
│       └── my-first-project/   ← we will create this
│           ├── notes/
│           └── scripts/
├── Applications/
└── System/

Every file on your computer lives somewhere in this tree. When someone says "navigate to a folder," they mean "move to a specific location in this tree."

What Is a Terminal?

Think of your computer as a house with many rooms (folders) full of drawers (files). Normally you click through windows and icons to open those rooms — that is the graphical interface. The terminal is a different door into the same house: instead of clicking, you type short text commands. It looks like a blank screen with a blinking cursor. That is all it is — a text-based way to talk to your computer.

Why use it? Because Claude Code lives in the terminal. To use Claude Code, you need to be comfortable typing commands. The good news: you only need about 15 commands to get started, and we will learn them one at a time.

How to Open the Terminal

  • Mac: Open Finder → Applications → Utilities → Terminal. Or press Cmd+Space, type "Terminal", and press Enter.
  • Windows: Press the Windows key, type "PowerShell", and press Enter. (We recommend installing Windows Subsystem for Linux — called WSL — for the best experience with Claude Code. Search "install WSL" in your browser for a step-by-step guide.)
  • Linux: Press Ctrl+Alt+T, or search for "Terminal" in your applications menu.

When you open the terminal, you will see something like this:

yourname@computer ~ %

That blinking cursor is waiting for you to type a command. Let us start.

Navigation Commands — Finding Your Way Around

pwd — Print Working Directory

Think of pwd as asking "Where am I right now?" It prints the full path to your current folder.

$ pwd
/Users/yourname

The $ symbol is just the prompt — you do not type it. You type pwd and press Enter. The computer responds with your location.

Common mistake: Typing PWD (uppercase). Commands are case-sensitive. Always use lowercase.

ls — List

Think of ls as opening a drawer to see what is inside. It shows everything in your current folder.

$ ls
Desktop    Documents    Downloads    Music    Pictures

Try ls -la to see hidden files (files starting with a dot) and extra details like file sizes and dates:

$ ls -la
total 0
drwxr-xr-x  12 yourname  staff  384 Feb 10 09:00 .
drwxr-xr-x   5 root      staff  160 Jan  1 00:00 ..
-rw-r--r--   1 yourname  staff   45 Feb 10 09:00 .bashrc
drwx------   4 yourname  staff  128 Feb 10 09:00 Desktop
drwx------   3 yourname  staff   96 Feb 10 09:00 Documents

Do not worry about the letters on the left (those are permissions — we will cover them much later). For now, just notice the file and folder names on the right.

cd — Change Directory

Think of cd as walking from one room to another. You type cd followed by the folder name.

$ cd Documents
$ pwd
/Users/yourname/Documents

Three special shortcuts:

  • cd .. — go back one level (step out of the room into the hallway)
  • cd ~ — go straight to your home folder (like pressing a "home" button)
  • cd / — go to the root of the file system (the very top of the tree)
$ cd ..
$ pwd
/Users/yourname

$ cd ~
$ pwd
/Users/yourname

Common mistake: Forgetting the space between cd and the folder name. cdDocuments will not work. It must be cd Documents.

File Management Commands — Creating and Organizing

mkdir — Make Directory

Creates a new folder. Think of it as adding a new room to the house.

$ mkdir my-first-project
$ ls
Desktop    Documents    Downloads    Music    Pictures    my-first-project

You just created your first folder from the terminal! Navigate into it:

$ cd my-first-project
$ pwd
/Users/yourname/my-first-project

Common mistake: Using spaces in folder names. mkdir my project creates TWO folders: "my" and "project". If you need spaces, use quotes: mkdir "my project". Better yet, use hyphens: mkdir my-project.

touch — Create an Empty File

Creates a new, empty file. Think of it as placing a blank sheet of paper in a drawer.

$ touch notes.txt
$ ls
notes.txt

The file exists but has nothing in it yet. We will learn how to put content in files shortly.

cp — Copy

Copies a file or folder. Think of it as photocopying a document.

$ cp notes.txt notes-backup.txt
$ ls
notes-backup.txt    notes.txt

To copy a folder and everything inside it, add -r (recursive):

$ cp -r notes notes-copy

mv — Move (or Rename)

Moves a file to a different location, or renames it. Think of it as picking something up and putting it somewhere else.

$ mv notes-backup.txt notes/
$ ls
notes.txt    notes/
$ ls notes/
notes-backup.txt

To rename a file, "move" it to a new name in the same folder:

$ mv notes.txt my-notes.txt

rm — Remove (Delete)

Deletes a file. Be very careful — there is no undo. There is no trash can. Once removed, it is gone.

$ rm my-notes.txt

To remove a folder and everything inside it:

$ rm -r notes-copy

Common mistake: Running rm -r on the wrong folder. Always double-check which folder you are in with pwd before deleting anything.

Reading Files

cat — Display Entire File

Prints the full contents of a file to the screen. Good for short files.

$ cat notes.txt
Hello, this is my first file!

less — Scroll Through a File

Opens a file in a scrollable viewer. Good for long files. Press q to quit, arrow keys to scroll, and / followed by a word to search.

$ less long-document.txt

head and tail — First or Last Lines

head shows the first 10 lines. tail shows the last 10 lines. Useful for peeking at a file without loading the whole thing.

$ head notes.txt
$ tail notes.txt

Environment Basics

echo — Print Text

echo prints whatever you type after it. Think of it as a "say this" command.

$ echo "Hello World"
Hello World

export — Set a Variable

Variables are named containers that hold a value. export creates a variable that other programs can read.

$ export MY_NAME="Claude Student"
$ echo $MY_NAME
Claude Student

The $ sign before the variable name means "give me the value stored in this variable."

PATH — The Command Search List

When you type a command like node, your computer does not magically know where the node program lives. It checks a list of folders called PATH — think of it as a phonebook your computer consults. If the program is in one of those folders, it runs. If not, you get "command not found."

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

Each folder is separated by a colon. When you install new tools (like Node.js), the installer usually adds its folder to PATH automatically.

Installing Node.js

Node.js is the engine that Claude Code runs on. You need it installed before you can use Claude Code. npm (Node Package Manager) comes bundled with Node.js — think of npm as an app store for code libraries.

Mac (using Homebrew):

Homebrew is a package manager for Mac — an app store you use from the terminal. First, install Homebrew if you do not have it:

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then install Node.js:

$ brew install node

Windows (using the installer):

Go to https://nodejs.org and download the LTS version. Run the installer and follow the prompts. Restart your terminal afterward.

Linux (using nvm):

$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
$ nvm install --lts

Verify the installation:

$ node --version
v22.13.1

$ npm --version
10.9.2

If you see version numbers (the exact numbers may differ), you are ready. If you see "command not found," close your terminal, reopen it, and try again — some installations need a terminal restart.

Practice Exercises

Exercise 1 (Guided): Build Your Project Folder

Follow these steps exactly and check your output after each command:

$ cd ~
$ pwd
/Users/yourname

$ mkdir my-first-project
$ cd my-first-project
$ pwd
/Users/yourname/my-first-project

$ mkdir notes
$ mkdir scripts
$ ls
notes    scripts

$ touch README.txt
$ touch notes/day1.txt
$ touch scripts/hello.sh
$ ls -la
total 0
drwxr-xr-x  5 yourname  staff  160 Feb 10 10:00 .
drwxr-xr-x  3 yourname  staff   96 Feb 10 10:00 ..
-rw-r--r--  1 yourname  staff    0 Feb 10 10:00 README.txt
drwxr-xr-x  3 yourname  staff   96 Feb 10 10:00 notes
drwxr-xr-x  3 yourname  staff   96 Feb 10 10:00 scripts

Verification: Run ls notes — you should see day1.txt. Run ls scripts — you should see hello.sh.

Exercise 2 (Independent): File Organization Challenge

Goal: Create the following folder structure entirely from the terminal:

~/practice/
├── documents/
│   ├── report.txt
│   └── summary.txt
├── images/
│   └── placeholder.txt
└── backups/

Hints:

  • Start with cd ~ then mkdir practice
  • Use cd to navigate into folders before creating files
  • Use ls -R practice from your home folder to verify the full tree (-R lists contents recursively)

Verification: ls -R ~/practice should show all three subfolders and three files.

Exercise 3 (Challenge): The Cleanup Mission

Create a messy folder with 5 files and 3 subfolders. Then reorganize it:

  • Move all .txt files into a documents subfolder
  • Copy (not move) one important file to a backups subfolder
  • Delete any files you do not need
  • End with a clean, organized structure

Document every command you used in a file called cleanup-log.txt (use echo "command here" >> cleanup-log.txt to append lines to the file).

Self-Assessment Quiz

1. What does pwd stand for, and what does it do?

2. What is the difference between mv and cp?

3. Why is rm considered dangerous? What safety step should you always take before using it?

4. What is PATH, and what happens when you type a command that is not in any PATH folder?

5. After running node --version and getting "command not found," what should you try first?

Answers:

  1. pwd stands for "print working directory." It displays the full path to the folder you are currently in.

  2. mv moves a file (the original disappears from its old location). cp copies a file (the original stays where it is, and a duplicate is created).

  3. rm permanently deletes files with no undo and no trash can. You should always run pwd first to confirm you are in the correct folder, and double-check the file name before pressing Enter.

  4. PATH is a list of folders your computer searches when you type a command. If the command is not found in any PATH folder, you get a "command not found" error.

  5. Close the terminal completely, reopen it, and try again. Many installations require a terminal restart to update the PATH.

Terminal & Environment Updates (Feb 2026)

  • Terminal rendering performance improved significantly (v2.1.39)
  • Fatal errors are now properly displayed instead of being swallowed (v2.1.39)
  • Process hanging after session close fixed (v2.1.39)
  • Vim normal mode now supports arrow key history navigation when cursor cannot move further (v2.1.20)
  • External editor shortcut (Ctrl+G) added to the help menu (v2.1.20)
  • Customizable spinner verbs via spinnerVerbs setting (v2.1.23)
  • mTLS and proxy connectivity fixed for corporate proxies and client certificates (v2.1.23)
  • Installation change: npm installations are deprecated — use claude install instead (v2.1.15)

Exercise:

  • Run claude install if you previously installed via npm
  • Try Ctrl+G to open an external editor from within Claude Code
  • Customize your spinner verbs in settings

Maintaining Your Claude Code Environment

  • The ~/.claude directory stores session data, memories, and settings. It can grow to 1GB+ after a few weeks of daily use.
  • There is no built-in auto-cleanup — periodically review and prune old session data.
  • Key space consumers: session transcripts, tool outputs, and cached context.

Token Optimization: Reducing Context Noise

  • The problem: Claude Code sends raw terminal output (passing tests, verbose logs, status bars) into the LLM context window — most of it is noise you're paying tokens for
  • Impact: Unoptimized sessions can use 10x+ more tokens than necessary
  • Strategies:
    1. Keep commands focused: Use targeted commands (grep, head, tail) instead of dumping entire files or logs
    2. Filter test output: Run specific test files/cases instead of full suites when debugging
    3. Use .claudeignore: Exclude build artifacts, node_modules, and generated files from context
    4. Leverage subagents: Claude Code's Task tool offloads exploration to subagents, keeping the main context clean
    5. Community tools: Projects like CLI proxies (e.g., rtk) can filter terminal output before it reaches context

Exercise: Run a Claude Code session on a project. Check token usage with /cost. Then repeat the same task using focused commands and .claudeignore — compare the token difference.

Discussion: Community thread on token savings

Claude Code npm 2.1.41 (latest) (added 2026-02-13) @anthropic-ai/claude-code@2.1.41 published to... Source: https://www.npmjs.com/package/@anthropic-ai/claude-code/v/2.1.41

Claude Code npm 2.1.42 (latest) (added 2026-02-13) @anthropic-ai/claude-code@2.1.42 published to... Source: https://www.npmjs.com/package/@anthropic-ai/claude-code/v/2.1.42