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.

30–40 min Week 1 · Terminal basics Ubuntu terminal
Your outcome: You can move around like you would in Finder or File Explorer, but with precise path names.
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 folder

Moves home, then returns to the sandbox.

Run from ~/linux-practice

cd ~
pwd
cd ~/linux-practice
pwd

Practice parent folders

Safe in practice folder

Shows 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 view

cd - 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 view

Visits Ubuntu configuration folders without editing anything.

Run from anywhere

cd /etc
pwd
ls -l | head -20
cd ~/linux-practice

Put it into practice

  1. Navigate into files/demo and back to ~/linux-practice.
  2. 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.

  1. Which path type starts with /?
  2. What does cd - do?

Your practice, your pace

Loading saved progress…

Discussion

Continue the conversation about this guide. Loading comments connects to GitHub Discussions through giscus.

Open community discussions on GitHub

Check before you copy

This command needs care. Read its context, confirm the target and location, and keep a recovery path.

Copying does not run a command.