Mission 2 of 30
Changing Directories and Understanding Paths
Move between known locations and return home without losing your place.
Move around safely using absolute paths, relative paths, home shortcuts, and parent folders.
Practice inside
~/linux-practice. Check your setup before you begin.
Prerequisite: Fundamental Navigation
.
What you’ll practice
- Use cd safely
- Understand absolute vs relative paths
- Return to the practice folder from anywhere
The mental model
- Absolute paths start with /.
- Relative paths start from where you currently are.
- . means here; .. means parent folder.
- cd - returns to the previous directory (tracked in $OLDPWD).
Try it in your terminal
Move to home and back
Safe in practice folderMoves home, then returns to the sandbox.
Run from ~/linux-practice
cd ~
pwd
cd ~/linux-practice
pwd Practice parent folders
Safe in practice folderShows how .. climbs up one level at a time.
Run from ~/linux-practice
cd ~/linux-practice
mkdir -p files/demo
cd files/demo
pwd
cd ..
pwd
cd ../..
pwd Return to previous directory
Read-only system viewcd - switches back to the last directory you were in, without retyping the path.
Run from ~/linux-practice
cd ~/linux-practice
cd /tmp
pwd
cd -
pwd Read-only visit to /etc
Read-only system viewVisits Ubuntu configuration folders without editing anything.
Run from anywhere
cd /etc
pwd
ls -l | head -20
cd ~/linux-practice Put it into practice
- Navigate into files/demo and back to ~/linux-practice.
- Write down one absolute path and one relative path.
Check your result
You can leave the workspace and return using absolute and relative paths.
Common mistakes
- You type `cd /` thinking it takes you home. It doesn't. `/` is the root of the entire filesystem — the attic, not your bedroom. `cd ~` is home. Remember the difference.
- You wander into /etc and start reading config files like a tourist at a museum. Looking is fine. Editing those files is a different course. Stay in your practice folder while learning.
Check your understanding
Explain these in your own words. If you’re unsure, revisit the examples before moving on.
- Which path type starts with /?
- What does cd - do?
Your practice, your pace
Loading saved progress…