Lab 03: Directory Navigation

Objective

Move around the Linux filesystem with confidence: cd, ls, absolute vs relative paths, tab completion, and navigation shortcuts. You'll create a realistic project structure and navigate it fluently.

Time: 25 minutes | Level: Foundations | Docker: docker run -it --rm ubuntu:22.04 bash


Step 1: Your Starting Position

pwd

📸 Verified Output:

/
cd ~
pwd

📸 Verified Output:

/root

💡 ~ (tilde) is a shortcut for your home directory. cd ~ always brings you home no matter where you are — like pressing the home button on your phone.


Step 2: Exploring Your Home

ls -la

📸 Verified Output:

💡 . = current directory. .. = parent directory. Files starting with . are hidden — only visible with ls -a. .bashrc and .profile are shell startup scripts.


Step 3: Create a Project Structure

📸 Verified Output:

💡 mkdir -p creates all intermediate directories at once. Without -p, mkdir projects/webapp/src would fail if projects/ doesn't exist yet.


Step 4: Absolute vs Relative Paths

Absolute path — always starts with /, works from anywhere:

📸 Verified Output:

Relative path — relative to where you currently are:

📸 Verified Output:

📸 Verified Output:

💡 .. goes up one level in the directory tree. ../../ goes up two levels. ../sibling goes up one then into sibling — without ever needing to know the full absolute path.


Step 5: Navigation Shortcuts

📸 Verified Output:

📸 Verified Output:

💡 cd - is like the "back" button in a browser — instantly returns to your previous directory. Extremely useful when switching between two distant directories.


Step 6: Listing Options

📸 Verified Output:

📸 Verified Output:

📸 Verified Output:


Step 7: Traverse the Filesystem

📸 Verified Output:

📸 Verified Output:

📸 Verified Output:


Step 8: Capstone — Navigate a Security Lab Structure

📸 Verified Output:


Summary

Command / Shortcut
Meaning

cd ~ or cd

Go to home directory

cd -

Return to previous directory

cd ..

Go up one level

cd ../..

Go up two levels

pwd

Print current directory

ls -la

List all files with details

ls -lh

List with human-readable sizes

ls -lt

List sorted by modification time

mkdir -p a/b/c

Create nested directories at once

Last updated