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/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
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.
- 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
| 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 |
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.
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.
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.
Step 3: Go somewhere
Type cd projects to move into the projects folder, then ls to see what’s inside.
Step 4: Go deeper
Now that you’re in projects, go into my-app:
Step 5: Go back
Type cd .. to go back up one level. The .. means “the folder above this one.”
Step 6: Go home
No matter where you are, cd ~ takes you straight home:
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):
cd /home/user/projects/my-appRelative path — from where you currently are (like “turn left, then go two blocks”):
cd projects/my-appIf 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.
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) | cd / goes to root |
../.. | Two levels up | cd ../.. goes up two levels |
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:
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 the terminal simulator above:
- Start at
/home/user(runcd ~if you’re not there) - Navigate into
projects/data-analysis - Read the contents of
notes.txt(usecat notes.txt—catprints a file’s contents to the screen) - 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
- 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.
cdmoves 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:
pwdto check where you are,cd ~to go home,lsto 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 (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 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.