Moving into folders
You know how to ask where am I? (pwd) and what’s in here? (ls). The natural next
question is: how do I go somewhere else?
The answer is cd — change directory. In a graphical file explorer, you double-click a
folder to step into it. In a terminal, you type cd and the folder’s name.
Try it
Run ls to see what folders are around you. You’ll probably spot something familiar like
Documents or Desktop. Step into one:
cd Documents
Press Enter. Nothing dramatic happens — no message, no animation. The terminal is quietly saying “done.” Now check:
pwd
The path changed. You moved. Run ls again and you’ll see the contents of Documents
instead of the contents of where you started.
That’s cd in one sentence: it changes which folder you’re standing in.
When the name doesn’t work
Two things bite beginners on their first cd:
1. Spelling and capitalization matter. cd documents and cd Documents are not the same
on most systems. If the folder is called Documents with a capital D, you must type the
capital D.
2. Spaces need quotes. If a folder has a space in its name — like My Stuff — type:
cd "My Stuff"
Without the quotes, the terminal thinks you’re trying to cd into something called My and
then doing something weird with Stuff. It’ll complain.
The Tab key is your friend
Type the first few letters of a folder name and press Tab. The terminal will auto-complete the rest if there’s only one match. Try:
cd Doc
Then press Tab. It expands to cd Documents/ for you. This is the single biggest
quality-of-life trick in the terminal. Use it constantly:
- Saves typing.
- Catches spelling mistakes (if it doesn’t auto-complete, the folder doesn’t exist).
- Handles spaces automatically.
If you ever type a long path by hand without pressing Tab, you’re doing it the hard way.
What you’ve learned
cd <folder>moves you into a folder.- Names are case-sensitive on most systems.
- Wrap names with spaces in
"quotes". - Tab auto-completes — use it always.
Next: how to step back out of a folder, and how to teleport back to your home folder when you get lost.