IntroToLinux

7. Essential Navigation Commands


๐Ÿงญ Basic Navigation

๐ŸŽฏ Core Commands

Command Purpose Icon
pwd Print Working Directory ๐Ÿ“
cd Change Directory ๐Ÿšถ
ls List directory contents ๐Ÿ“‹

๐Ÿงช Lab 2.1: Basic Navigation (5 minutes)

Step-by-Step Guide

# 1๏ธโƒฃ Check current directory
pwd
# Output: /home/user

# 2๏ธโƒฃ Go to home directory (all equivalent)
cd
cd ~
cd $HOME

# 3๏ธโƒฃ Go to root directory
cd /

# 4๏ธโƒฃ Go back to home directory
cd ~

# 5๏ธโƒฃ List current directory contents
ls

# 6๏ธโƒฃ List with details
ls -l

# 7๏ธโƒฃ List including hidden files
ls -la

๐Ÿ“บ Sample Terminal Session

user@localhost:~$ pwd
/home/user
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ โœ… Shows current location  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

user@localhost:~$ cd
user@localhost:~$ pwd
/home/user
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ โœ… Still in home directory โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

user@localhost:~$ cd /
user@localhost:~$ pwd
/
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ โœ… Now at root directory   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

user@localhost:~$ cd ~
user@localhost:~$ pwd
/home/user
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ โœ… Back to home directory  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐ŸŽ“ Navigation Shortcuts

| Shortcut | Destination | Example | |โ€”โ€”โ€”-|โ€”โ€”โ€”โ€”-|โ€”โ€”โ€”| | cd or cd ~ | ๐Ÿ  Home directory | /home/user | | cd / | ๐ŸŒณ Root directory | / | | cd .. | โฌ†๏ธ Parent directory | Up one level | | cd - | โ†ฉ๏ธ Previous directory | Last location | | cd ~/Documents | ๐Ÿ“ Subdirectory of home | /home/user/Documents | โ€”

Next: โ†’ Essential File Commands
Previous: โ† File System Permissions
Lesson Home: โ†‘ Lesson 2: The Shell
Course Home: โŒ‚ Introduction to Linux