Foundations Module 3 · Command Line Basics

Navigating the Filesystem

What you'll learn

~15 min
  • Use pwd, ls, and cd to navigate the filesystem
  • 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
  • /home is the residential floor
  • /home/user is your apartment (your home directory)
  • /home/user/projects is a room in your apartment
  • /home/user/projects/my-app is a drawer in that room

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, these three commands are enough for most tasks.

Home directory paths differ by OS
  • Linux: /home/yourname
  • macOS: /Users/yourname
  • Windows (WSL/Git Bash): /home/yourname
  • Windows (PowerShell): C:\Users\yourname

This lesson’s examples use Linux-style paths. Your actual paths will match your OS, but the commands work the same way.

The big three commands

CommandWhat it doesMemory trick
pwdShows where you arePrint Working Directory
lsShows what’s hereList
cdMoves you somewhereChange Directory

These three commands are like having a map, a flashlight, and your legs:

  • pwd = look at the map (where am I?)
  • ls = shine the flashlight (what’s around me?)
  • cd = walk to a new room (go somewhere)

Try it yourself

Here’s a simulated terminal with a pre-built filesystem. Work through the exercises below — each one builds on the last.

Claude Code — Practice Mode
Type a command and press Enter. Try: pwd, ls, cd projects, help
/home/user $

Step 1: Where am I?

Type pwd and press Enter.

You’ll see /home/user — that’s your current location (your “home” directory). Think of it as the address of the room you’re standing in.

TRY ITPrint your current working directory
$

Step 2: What’s here?

Type ls and press Enter.

You’ll see a list of files and folders in your current directory. This is like opening a folder and seeing its contents.

TRY ITList the contents of your current directory
$

Step 3: Go somewhere

Type cd projects to move into the projects folder, then ls to see what’s inside.

TRY ITNavigate into the 'projects' directory
$

Step 4: Go deeper

Now that you’re in projects, go into my-app:

TRY ITNavigate into the 'my-app' directory (you're currently in projects)
$

Step 5: Go back

Type cd .. to go back up one level. The .. means “the folder above this one.”

TRY ITGo back up to the parent directory
$

Step 6: Go home

No matter where you are, cd ~ takes you straight home:

TRY ITNavigate directly back to your home directory from anywhere
$

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 root (like a street address):

Terminal window
cd /home/user/projects/my-app

Relative path — from where you currently are (like “turn left, then go two blocks”):

Terminal window
cd projects/my-app

If you’re already in /home/user, both commands take you to the same place. Relative paths are shorter, so people use them more often in daily work.

How do you know which to use?

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

SymbolMeansExample
~Your home directorycd ~ goes home
.Current directorycd . goes nowhere
..Parent directorycd .. goes up one level
/Root (top of everything)cd / goes to root
../..Two levels upcd ../.. goes up two levels
💡Tab completion saves typing

Start typing a folder name and press Tab — the terminal will auto-complete it. In most Bash/Zsh terminals, press Tab twice to list all matches. 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:

/home/user
pwd # Where am I?
ls # What's here?
# documents projects downloads hello.txt
cd projects # Go into projects
ls # What projects do I have?
# my-app data-analysis
cd my-app # Go into my-app
ls # 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/user

Notice 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 the terminal simulator above:

  1. Start at /home/user (run cd ~ if you’re not there)
  2. Navigate into projects/data-analysis
  3. Read the contents of notes.txt (use cat notes.txtcat prints a file’s contents to the screen)
  4. Go back to your home directory
  5. Navigate into documents and 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.

KNOWLEDGE CHECK

You're in /home/user/projects/my-app. What command takes you to /home/user?

KNOWLEDGE CHECK

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.

Symptom
I get 'No such file or directory' when I try to cd into a folder
Evidence
bash: cd: projcts: No such file or directory
What to ask the AI
"Check your spelling — 'projcts' is missing an 'e'. Run ls first to see the exact folder names, then use tab completion (type the first few letters and press Tab) to avoid typos."
Symptom
I'm lost and don't know where I am in the filesystem
Evidence
I've been using cd and now I have no idea where I am
What to ask the AI
"Run pwd to see your current location. Then run cd ~ to go back to your home directory and start fresh. There's no penalty for going home and navigating again from there."
Symptom
cd .. doesn't seem to go anywhere
Evidence
I typed cd .. but pwd still shows the same directory
What to ask the AI
"Make sure there's a space between cd and the two dots: 'cd ..' (with a space). If you're already at the root (/), cd .. won't go higher because there's nothing above root."

Key takeaways

  • Three commands are all you need to navigate: pwd (where am I?), ls (what’s here?), cd (go somewhere).
  • The filesystem is a tree of nested folders. cd moves you down into folders, cd .. moves you back up.
  • Absolute paths (starting with /) 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: pwd to check where you are, cd ~ to go home, ls to look around.
🔍What's actually in the root (/) directory?

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 (like ls, cat, mkdir). Note: cd is 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 99% 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 the essential commands for creating, moving, and deleting files — the building blocks for everything else.