LAB-NAV-02 - Paths, Symbols & Tab Completion
Master absolute vs relative paths, decode Linux symbols (., .., ~), and use Tab completion to reduce mistakes and effort.
Paths, Symbols & Tab Completion
Master absolute vs relative paths, decode Linux symbols (., .., ~), and use Tab completion to reduce mistakes and effort.
- Master absolute vs relative paths, decode Linux symbols (., .., ~), and use Tab completion to reduce mistakes and effort.
- Repeat the workflow without copy-paste or step-by-step prompting.
- Use only safe practice paths so a wrong `cd` or wildcard does not land you in a real system directory.
Part A: The Field Guide
What and Why
Navigation gets easier once you stop treating every path as a fresh string to memorize.
Paths follow a few consistent rules. Learn those rules and the terminal becomes much less fragile.
The Core Distinction
Absolute paths
Absolute paths start from the top.
Examples:
/var/log/etc/passwd
Relative paths
Relative paths start from where you are now.
Examples:
Documents../Downloads
The golden rule
If a Linux path starts with /, it is absolute. If it does not, it is relative.
The Three Symbols You Need
..
Go up one level.
.
Means the current location.
~
Means your home directory.
pwd cd .. cd ~ ./script.sh
Tab Completion
Tab completion is not a luxury feature. It is an error-reduction tool.
Use it because it helps you:
- type less
- catch wrong folder names earlier
- learn real path names faster
If nothing completes, pause and check spelling or location.
Common Beginner Failure Points
These show up constantly:
- using a relative path from the wrong starting place
- confusing
/with~ - forgetting that
./script.shmeans "run the script in this directory" - ignoring Tab completion and making avoidable typos
Part B: The Drill Deck
Terminal Required: Use your Linux terminal for these exercises.
G Guided Step by step - type exactly this and compare the result >
Exercise G1: Absolute versus relative
- Run
cd /tmp. - Run
pwd. - Try
cd varand notice why it fails. - Run
cd /varand notice why it works. - Run
cd logand confirm where you landed.
Exercise G2: Use the symbols
- From
/var/log, runcd ... - Run
pwd. - Run
cd ~. - Run
pwd. - Explain the difference between
..and~.
Exercise G3: Try Tab completion
- Start at
/. - Type
cd uand pressTab. - Continue into
/usrand one subdirectory using Tab completion as much as possible. - If completion does nothing, stop and inspect why.
S Solo Task described, hints available - figure it out >
Exercise S1: Absolute jumps
Use only absolute paths to visit:
/etc/var/log/usr/tmp
Verify each with pwd.
Exercise S2: Relative crawling
Start in /usr/share and reach /usr and then /tmp using relative movement and .. where appropriate.
Exercise S3: Home shortcuts
From /var/log, do all three:
- list the contents of your home directory without moving there
- jump to your home directory
- jump back to the previous directory if your shell supports
cd -
M Mission Real scenario - no hints, combine multiple skills >
Mission M1: Minimal typing
Pick a deep directory that exists on your machine, such as /usr/share or /var/log.
Navigate there using Tab completion as much as possible. The goal is to reduce typing errors, not to win a speed contest.
Mission M2: Explain the path, not just the command
For each of these, explain why it works before you run it:
cd /var/logcd ..cd ~./script.sh
If you can explain the rule behind each one, you understand more than just the syntax.
What to do next
Best next step LearningReturn to the related lesson if you want the concept explained more deeply.