Foundations Module 3 · Command Line Basics

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:

CommandWhat it doesMemory trick
pwdShows where you arePrint Working Directory
lsShows what’s hereList
cdMoves you somewhereChange 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.

Terminal — 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 something like /home/user — that’s your current location (your “home” directory).

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. Folders usually appear in a different color (blue in many terminals).

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 back

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

TRY ITGo back up to the parent directory
$

The filesystem is like a building

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
  • /home/user/projects is a room in your apartment
  • /home/user/projects/my-app is 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:

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

Relative path — from where you currently are:

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.

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
💡Tab completion saves typing

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:

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

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.