Navigating the Filesystem
pwd, ls, cd — moving around your files and folders
The big picture
Your computer organizes everything into files and folders (also called directories). It’s a tree structure — folders contain files and other folders, all the way up to one root folder.
When you use your computer normally, you click through folders in Finder (Mac), File Explorer (Windows), or Files (Linux). In the terminal, you navigate the same tree — just by typing instead of clicking.
You only need 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 |
That’s it. Three commands to go anywhere.
Try it yourself
Here’s a simulated terminal. It behaves just like a real one — try the commands below.
Step 1: Where am I?
Type pwd and press Enter.
You’ll see something like /home/user — that’s your current location (your “home” directory).
Step 2: What’s here?
Type ls and press Enter.
You’ll see a list of files and folders in your current directory. Folders usually appear in a different color (blue in many terminals).
Step 3: Go somewhere
Type cd projects to move into the projects folder, then ls to see what’s inside.
Step 4: Go back
Type cd .. to go back up one level. The .. means “the folder above this one.”
The filesystem is like a building
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/home/user/projectsis a room in your apartment/home/user/projects/my-appis a drawer in that room
pwd tells you which room you’re standing in.
ls shows you what’s in the room.
cd lets you walk to another room.
Paths: absolute vs relative
There are two ways to describe a location:
Absolute path — the full address from root:
cd /home/user/projects/my-appRelative path — from where you currently are:
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.
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 |
Start typing a folder name and press Tab — the terminal will auto-complete it. If there are multiple matches, press Tab twice to see all options. This alone will save you hours of typing.
Putting it together
Here’s a typical navigation session:
pwd # Where am I?ls # What's here?# documents projects downloads
cd projects # Go into projectsls # What projects do I have?# my-app portfolio notes
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# /home/userWhat’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.