student@ubuntu:~$
shell 1/5 25 XP

File System Navigation

0%

Quick Reference

Command What It Does
pwd Print current directory (where am I?)
cd /path Change to an absolute path
cd dirname Change to a subdirectory (relative)
cd .. Go up one directory
cd ~ or cd Go to your home directory
cd - Go to your previous directory
ls List files in current directory
ls -l Long format (permissions, size, date)
ls -a Show hidden files too
ls -la Long format + hidden files

Absolute vs. Relative Paths

Type Starts with Example Depends on current location?
Absolute / /home/student/cscd240/lab1 No – works from anywhere
Relative anything else cscd240/lab1 or ../lab2 Yes

Special Path Symbols

Symbol Meaning
/ Root of the file system
~ Your home directory (/home/yourusername)
. Current directory
.. Parent directory (one level up)
- Previous directory (with cd)

How It Works

The File System Tree

/                    <-- root (top of the tree)
├── home/
│   └── student/     <-- your home directory (~)
│       ├── cscd240/
│       │   ├── lab1/
│       │   └── lab2/
│       └── .bashrc  <-- hidden config file
├── etc/             <-- system configuration
├── usr/
│   └── bin/         <-- installed commands
├── bin/             <-- essential commands
└── tmp/             <-- temporary files
Terminal
student@ubuntu:~$ pwd
/home/student

# Absolute path -- works from anywhere
student@ubuntu:~$ cd /home/student/cscd240/lab1
student@ubuntu:~/cscd240/lab1$ pwd
/home/student/cscd240/lab1

# Go home, then use relative path
student@ubuntu:~/cscd240/lab1$ cd ~
student@ubuntu:~$ cd cscd240/lab1

# Go up two levels
student@ubuntu:~/cscd240/lab1$ cd ../..
student@ubuntu:~$ pwd
/home/student

Reading ls -l Output

Terminal
student@ubuntu:~$ ls -la
total 32
drwxr-x--- 5 student student 4096 Mar 30 09:00 .
drwxr-xr-x 3 root root 4096 Mar 28 14:00 ..
-rw-r--r-- 1 student student 220 Mar 28 14:00 .bashrc
drwxr-xr-x 4 student student 4096 Mar 30 08:45 cscd240
-rw-r--r-- 1 student student 52 Mar 30 09:00 notes.txt
drwxr-xr-x 4 student student 4096 Mar 30 08:45 cscd240
│           │ │       │       │    │              └── name
│           │ │       │       │    └── modification date
│           │ │       │       └── size (bytes)
│           │ │       └── group
│           │ └── owner
│           └── link count
└── permissions (d = directory)

Common Pitfalls

  • cd alone goes home, not up – use cd .. to go up one level.
  • “No such file or directory” – run pwd and ls to check where you are and what’s there.
  • cd /lab1 vs cd lab1 – the leading / means “start at root,” not “start here.” Huge difference.
  • Hidden files are invisible by default – use ls -a to see files starting with . (like .bashrc).

Unlocks

Complete this skill to see what it unlocks.