Suggested day 220–30 minutesRead-only system view

Mission 2 of 5

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.

Outcome: You can move around like you would in Finder or File Explorer, but with precise path names.

Mental model

Understand what is happening

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).

Guided lab

Work through the mission

1

Move to home and back

Safe

Moves home, then returns to the sandbox.

Terminal
cd ~
pwd
cd ~/linux-practice
pwd
2

Practice parent folders

Safe

Shows how .. climbs up one level at a time.

Terminal
cd ~/linux-practice
mkdir -p files/demo
cd files/demo
pwd
cd ..
pwd
cd ../..
pwd
3

Return to previous directory

Read-only

cd - switches back to the last directory you were in, without retyping the path.

Terminal
cd ~/linux-practice
cd /tmp
pwd
cd -
pwd
4

Read-only visit to /etc

Read-only

Visits Ubuntu configuration folders without editing anything.

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

Checkpoint

Verify the mission

You can leave the workspace and return using absolute and relative paths.

Try it yourself

One step without a recipe

Navigate into files/demo and back to ~/linux-practice. Write down one absolute path and one relative path.

Need a hint?

When you feel lost, type `cd ~` and hit Enter. Home is your reset button. From there, navigate forward with a clear path. Nobody remembers every absolute path on their first week.

Explain it back

Before you move on

  • Which path type starts with /?
  • What does cd - do?

Shortcuts:Alt + ← previous lessonAlt + → next lessonAlt + H home? focus search