Navigating the Filesystem
Last reviewed
BeginnerWhat you'll learn
~15 min- Use pwd, ls, and cd to navigate the filesystem
- Make a folder with mkdir and move into it
- Understand absolute vs relative paths
- Use path shortcuts (~, .., .) to move efficiently
- Build a mental model of the filesystem as a tree
By the end of this lesson, you will be able to move around your computer’s filesystem entirely through the terminal — checking where you are, seeing what’s around you, and going wherever you need to go.
The mental model: a building with rooms
Think of your computer’s filesystem like a building:
/(root) is the ground floor — everything is inside it/homeis the residential floor/home/useris your apartment (your home directory)/home/user/projectsis a room in your apartment/home/user/projects/my-appis a drawer in that room
Windows uses the same shape with different labels: the ground floor is the drive (C:\), and your apartment is C:\Users\Name.
Right now, when you want to find a file, you open Finder or File Explorer and click through folders. In the terminal, you do the same thing, but by typing instead of clicking. For beginner navigation, three commands to move around plus one to make folders are enough for most tasks.
- Windows (PowerShell):
C:\Users\yourname - macOS:
/Users/yourname - Linux:
/home/yourname - Windows (WSL/Git Bash):
/home/yourname
This lesson’s examples use Linux-style paths. Your actual paths will match your OS, but the commands work the same way, and PowerShell accepts forward slashes too, so cd projects/my-app works there.
The four survival commands
| Command | What it does | Memory trick |
|---|---|---|
pwd | Shows where you are | Print Working Directory |
ls | Shows what’s here | List |
cd | Moves you somewhere | Change Directory |
mkdir | Makes a new folder | Make Directory |
All four work the same in PowerShell, macOS and Linux. Think of them as a map, a flashlight, your legs, and a key to a new room:
pwd= look at the map (where am I?)ls= shine the flashlight (what’s around me?)cd= walk to a new room (go somewhere)mkdir= add a new room (make a folder)
Try it yourself: a 5-minute walkthrough
Use your own terminal. Start in your ai-class folder, the same one your agent uses from Lesson 1.2 (run cd ~/ai-class, or cd $HOME\ai-class in PowerShell, if you closed the window). Run each line, press Enter, and compare against the check underneath.
Step 1: Confirm where you are
pwdHow to check it worked: the path ends in ai-class. The prompt ends the same way: PS C:\Users\Name\ai-class> on PowerShell, name@computer ai-class % (or ~/ai-class$) on macOS and Linux.
Step 2: Make a subfolder and go into it
mkdir notescd notespwdHow to check it worked: mkdir prints nothing. After cd notes, your prompt ends in notes, and pwd shows a path ending in ai-class/notes (ai-class\notes on Windows). Run ls: the folder is empty, so nothing is listed.
Step 3: Step back up with ..
cd ..pwdThe .. means “the folder above this one.”
How to check it worked: the prompt and pwd end in ai-class again. Run ls and you will see notes.
Step 4: Jump home with ~
cd ~pwdHow to check it worked: pwd prints your home folder (C:\Users\Name, /Users/name, or /home/name). The prompt shows ~ or your user name instead of ai-class.
Step 5: Let Tab finish the name
Type cd ai-c and press the Tab key. Do not press Enter yet.
How to check it worked: the terminal completes the line to cd ai-class. If it doesn’t, press Tab twice to see the options, or type a few more letters. Now press Enter, then cd notes and pwd to confirm you’re two levels down.
Tab completion saves typing and catches typos, so use it all the time. Finish with cd ~ to head home.
Some guides write mkdir my-first-project && cd my-first-project on one line. Windows PowerShell 5.1, the version built into Windows, rejects &&, while two separate lines work in every shell. This course always uses two lines.
Paths: absolute vs relative
There are two ways to describe a location, just like there are two ways to give directions:
Absolute path: the full address from the top of the filesystem (like a street address):
cd /home/user/projects/my-appOn Windows, the top is the drive letter instead of /:
cd C:\Users\Name\projects\my-appRelative path: from where you currently are (like “turn left, then go two blocks”):
cd projects/my-appIf you’re already in your home folder, the relative and absolute versions take you to the same place. Relative paths are shorter, so people use them more often in daily work.
Use relative paths when the destination is nearby (a folder inside your current location). Use absolute paths when you want to jump to a completely different area of the filesystem, or when you want to be certain about where you’re going regardless of your current location.
Special path shortcuts
| Symbol | Means | Example |
|---|---|---|
~ | Your home directory | cd ~ goes home |
. | Current directory | cd . goes nowhere |
.. | Parent directory | cd .. goes up one level |
/ | Root (top of everything) on macOS and Linux; on Windows the top is the drive, C:\ | cd / goes to root |
../.. | Two levels up | cd ../.. goes up two levels |
Start typing a folder name and press Tab and the terminal will auto-complete it. In most Bash/Zsh terminals, press Tab twice to list all matches; in PowerShell, pressing Tab again cycles through them. This alone will save you hours of typing and prevent typos.
For example, type cd pro then press Tab, and the terminal fills in cd projects for you.
📊In Your Field: MIS / Businessclick to expand
In business analytics, you’ll often work with folder structures like /home/user/projects/q4-report/data/ with subfolders for raw data, cleaned data, and outputs. Navigating this structure with cd and ls is much faster than clicking through File Explorer, especially when you’re running scripts that process files in specific directories. Understanding paths also helps when you configure tools to read from or write to specific locations.
Putting it together: a real navigation session
Here’s what a typical session looks like. Follow the comments to understand each step:
pwd # Where am I?ls # What's here?# documents projects downloads hello.txt
cd projects # Go into projectsls # What projects do I have?# my-app data-analysis
cd my-app # Go into my-appls # What files are here?# index.html style.css README.md
cd ../.. # Go up two levels (back to /home/user)pwd # Verify I'm home# /home/userNotice the pattern: navigate, look, navigate, look. You’re constantly alternating between cd (move) and ls (look around). This is how everyone uses the terminal — even experienced developers.
Practice challenge
Try this sequence in your own terminal:
- Start in your home folder (run
cd ~if you’re not there) - Navigate into
ai-class/notesin a single command - Run
pwdto confirm where you landed - Go back to your home directory
- Navigate into
Documentsand list the files there
🧬In Your Field: Biotechclick to expand
Research data often follows a structure like /home/user/lab/experiment-2026-02/raw/ with subdirectories for each run. When you SSH into a university cluster to process data, you’ll use exactly these navigation commands to find your datasets, check output files, and move between experiment directories. The pwd command is especially critical — you always want to confirm you’re in the right experiment folder before running an analysis script.
You're in /home/user/projects/my-app. What command takes you to /home/user?
What is the difference between an absolute and relative path?
When Things Go Wrong
Use the Symptom → Evidence → Request pattern: describe what you see, paste the error, then ask for a fix.
Key takeaways
- Four survival commands:
pwd(where am I?),ls(what’s here?),cd(go somewhere),mkdir(make a folder). They work the same in PowerShell, macOS and Linux. - Make a folder and enter it with two lines:
mkdir name, thencd name. - The filesystem is a tree of nested folders.
cdmoves you down into folders,cd ..moves you back up. - Absolute paths (starting with
/, or a drive likeC:\on Windows) give the full address. Relative paths give directions from where you are now. ~always means your home directory —cd ~is your “home button.”- Use Tab completion to avoid typos: type the first few letters of a folder name and press Tab.
- When in doubt:
pwdto check where you are,cd ~to go home,lsto look around.
🔍What's actually in the root (/) directory?click to expand
On macOS or Linux, if you run cd / and then ls, you’ll see folders like bin, etc, home, tmp, usr, and var. These are system directories that organize how Linux works:
/home— where user directories live (your stuff is here)/tmp— temporary files (cleanup policy depends on system configuration)/etc— system configuration files/usr— system programs and libraries/bin— essential command programs (likels,cat,mkdir). Note:cdis built into the shell itself, not stored in/bin.
You’ll almost never need to go into these directly. Your work lives in /home/yourname, and that’s where you’ll spend nearly all of your time. But it’s good to know the building has other floors, even if you mostly stay in your apartment.
What’s next
You can now navigate anywhere on your computer through the terminal. In the next lesson, you’ll learn to recognise the file commands (cat, cp, mv, rm) that an AI agent runs for you, and which one deserves a second look.