Module 0.3

Filesystem & Terminal Basics

60 min · Read + lab

Welcome. This is the first thing every software engineer learns to use, and it’s been the same tool — the terminal — for over fifty years. By the end of this guide (about an hour) you’ll be comfortable navigating your computer from a command line, creating and moving files, and running the kind of commands you’ll use every day in the program.

You’ll be on a 15-inch MacBook Air with macOS, so all the commands here use the macOS / Unix flavor. The Linux servers we deploy to use the same commands — they share the same Unix lineage, which is one of the reasons macOS is a productive base for the program. (The commands in this module are built into macOS — no install needed. Other tools you’ll meet later, like uv and gh, are part of the separate macOS Installation Guide.)


1. What’s a filesystem?

Your computer organizes everything — applications, photos, videos, documents — into files. Files live inside folders (also called directories), and folders can contain other folders. The whole structure forms a tree.

The very top of the tree is / (a single forward slash), called the root. Everything underneath descends from there:

/
├── Users
│   └── kraj
│       ├── Desktop
│       ├── Documents
│       └── Downloads
├── Applications
└── System

Your home folder is at /Users/[your-username], and you’ll do nearly all your work inside it. The shorthand for “your home folder” is the tilde character: ~. So ~/Desktop means “the Desktop folder inside your home folder,” regardless of who you are.


2. Opening a terminal

Press Cmd + Space to open Spotlight, type Terminal, hit Enter. A window opens that looks something like this:

Last login: Tue Apr 28 09:14:22 on ttys000
your-mac:~ kraj$

That last line is called the prompt. The ~ shows that you’re currently sitting in your home folder. The $ is just punctuation — type your commands after it.

Alternatively, the terminal we’ll use most is the one inside VS Code. We’ll cover that in the VS Code essentials guide.


3. The eight commands you’ll use every day

There are hundreds of commands, but eight will cover 95% of your daily work. Memorize these.

pwd — “Print working directory”

Tells you where you currently are.

$ pwd
/Users/kraj

ls — “List”

Shows what’s in the current folder.

$ ls
Applications  Desktop  Documents  Downloads  Music  Pictures

Add -la to see everything, including hidden files (those starting with .):

$ ls -la
total 32
drwxr-xr-x  20 kraj  staff   640 Apr 28 09:14 .
drwxr-xr-x   6 root  admin   192 Mar 15 10:00 ..
-rw-------   1 kraj  staff  3204 Apr 27 18:32 .bash_history
drwxr-xr-x   8 kraj  staff   256 Apr 28 09:14 Desktop
...

The . means “this folder” and .. means “parent folder.” We’ll use those in the next command.

cd — “Change directory”

Moves you into a different folder.

$ cd Desktop
$ pwd
/Users/kraj/Desktop

Special shortcuts:

mkdir — “Make directory”

Creates a new folder.

$ mkdir summer-training
$ ls
... summer-training ...

touch — Creates an empty file

$ touch notes.txt
$ ls
notes.txt

If the file already exists, touch updates its modification timestamp.

cat — “Concatenate” (mostly: print a file’s contents)

$ cat notes.txt
(empty)
$ echo "Hello, world!" > notes.txt
$ cat notes.txt
Hello, world!

cp — “Copy”

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

To copy a whole folder, add the -r flag (for “recursive”):

$ cp -r summer-training summer-training-backup

mv — “Move” (also rename)

$ mv notes.txt journal.txt    # rename
$ mv journal.txt ~/Desktop/   # move to Desktop

mv is the same command for renaming and moving — renaming is just “moving to the same folder under a new name.”

rm — “Remove” (be careful!)

$ rm notes-backup.txt

To remove a folder and everything inside it:

$ rm -r summer-training-backup

⚠️ There is no Trash with rm. Once you remove a file, it’s gone. There is no undo. Always read your rm command carefully before pressing Enter, especially with -r.


4. Paths: absolute vs relative

A path is the way you refer to a file or folder. There are two flavors:

Absolute path — starts with /, fully describes location from the root:

/Users/kraj/Desktop/notes.txt

Relative path — describes where to go from where you currently are:

Desktop/notes.txt        # relative — assumes you're in /Users/kraj
./Desktop/notes.txt      # equivalent — the . means "here"
../kraj/Desktop/notes.txt  # using .. to go up first, then back down

In practice you’ll mix both. Absolute paths are unambiguous; relative paths are shorter when you’re already nearby.


5. Hands-on: the practice script

Open your terminal and type each of the following in order. Don’t paste — type each line. The muscle memory is the point.

cd ~                              # go home
pwd                               # confirm location
mkdir summer-training-practice    # create a practice folder
cd summer-training-practice       # go into it
pwd                               # confirm
mkdir practice                      # create a subfolder
cd practice                         # go into it
touch hello.txt                   # create empty file
echo "I am ready" > hello.txt     # write text into it
cat hello.txt                     # print it
ls                                # list contents
cd ..                             # back up one level
ls                                # see practice from outside
cp -r practice practice-backup        # copy the folder
ls                                # confirm both exist
mv practice-backup archive          # rename
ls                                # confirm rename
rm -r archive                     # delete the backup folder
ls                                # confirm it's gone
cd ~                              # back home

If everything ran without errors, you’ve used every command in this guide. Take a screenshot of the final terminal output and post it in #wins on Discord — that’s your proof of completion.


6. Environment variables

Software you run from the terminal often needs configuration that lives outside the code: API keys, URLs, secrets, preferences. These are stored in environment variables — named values that programs can read.

To see all of them:

$ env
PATH=/usr/local/bin:/usr/bin:/bin:...
HOME=/Users/kraj
USER=kraj
SHELL=/bin/zsh
... (many more)

To read one specifically:

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

(The $ prefix tells the shell “expand this variable.”)

To set one for the current session:

$ export ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxxxxxxxxx

In real projects, environment variables for a specific project live in a file called .env at the root of that project. Frameworks like Next.js read it automatically. We’ll cover this in detail in Week 4.

⚠️ Never commit your .env file to Git. It contains secrets. We’ll always include .env in .gitignore.


7. Permissions, briefly

Every file on a Unix system has permissions — who can read it, write to it, execute it. You’ll occasionally see this:

$ ls -la
-rwxr--r--  1 kraj  staff  1234 Apr 28 09:14 script.sh

Reading the -rwxr--r--:

To make a script executable:

$ chmod +x script.sh
$ ./script.sh

You’ll need this rarely in this program — but seeing chmod in someone else’s instructions, you’ll know what they mean.


8. The four habits to build

Once you have the commands, the habits separate beginners from professionals.

  1. pwd whenever you’re confused. It’s your home base. Always know where you are before running a command.
  2. Tab-completion is your friend. Start typing a file or folder name, press Tab, and the shell finishes it for you. If there are multiple matches, press Tab twice to see them all. This prevents typos.
  3. Up arrow recalls previous commands. Pressing the up arrow walks back through your command history. Press it once to repeat your last command instead of retyping.
  4. Read errors instead of guessing. When a command fails, the message usually says exactly why. Read it before re-running blindly.

9. The cheat sheet — keep this open while you work

CommandWhat it does
pwdWhere am I?
lsWhat’s here?
ls -laWhat’s here including hidden files?
cd folderGo into a folder
cd ..Go up one level
cd ~Go home
mkdir nameCreate a folder
touch nameCreate an empty file
cat filePrint a file’s contents
cp src dstCopy a file
cp -r src dstCopy a folder
mv src dstMove or rename
rm fileDelete a file (no undo!)
rm -r folderDelete a folder and everything in it (no undo!)
echo $VARPrint an environment variable
export VAR=valSet an environment variable
TabAuto-complete
Up arrowPrevious command

What’s next

You’re now terminal-literate enough to handle Day 1 of the program. The next Get Started module — VS Code Essentials — shows you how to use these same commands inside the integrated terminal in VS Code, where you’ll do most of your real work.

When you’re ready, post a screenshot of your final terminal output (after running the practice script) in #wins on Discord with the message “Module 0.3 complete.” See you next module.