Skip to content
KodeTrail

Camp 1 · Step 2 of 12

cd, pwd, and paths

Move through your computer's folders from the keyboard — and never feel lost.

12 min+50 XP

The file system is a tree of folders. Two commands let you walk it confidently: pwd (where am I?) and cd (go there).

pwd: where am I?

Print Working Directory — your current location:

$ pwd
/home/ada/projects

The terminal is always "in" exactly one folder. When lost, pwd is your compass — start every navigation with it.

cd: change directory

cd projects       # go INTO the projects folder (below you)
cd ..             # go UP one level to the parent
cd ~              # jump to your home folder
cd /              # jump to the root of the whole system

.. is the universal "parent folder" and you'll use it constantly. cd with nothing takes you home.

Absolute vs. relative paths

This distinction unlocks everything:

  • Absolute — from the root, always starts with /: /home/ada/projects/trail. Works from anywhere, like a full postal address.
  • Relative — from where you are now: trail, ../music, ./notes. Shorter, but its meaning depends on your current location.
# If pwd is /home/ada:
cd projects/trail          # relative → /home/ada/projects/trail
cd /etc                    # absolute → /etc, no matter where you were
Checkpoint

You are in /home/ada/music. Which command moves you to /home/ada?

Checkpoint

A path starting with / is…

What's next

Looking around — ls and its most useful options.