Objective

Navigate the Linux filesystem confidently using absolute and relative paths, create and remove directories, and understand the Unix directory hierarchy.

Tools & Technologies

  • pwd
  • ls
  • cd
  • mkdir
  • rmdir
  • file
  • tree

Key Commands

pwd
ls -lah /etc
cd /var/log
mkdir -p projects/lab1
rmdir empty_dir
file mystery_file

Architecture Overview

graph TD ROOT[/] --> BIN[/bin] ROOT --> ETC[/etc] ROOT --> HOME[/home] ROOT --> VAR[/var] ROOT --> TMP[/tmp] HOME --> USER[/home/user] USER --> DOCS[~/Documents] USER --> PROJ[~/projects] VAR --> LOG[/var/log] VAR --> WWW[/var/www] style ROOT fill:#1a1a2e,stroke:#00d4ff,color:#e0e0e0 style HOME fill:#1a1a2e,stroke:#00ff88,color:#e0e0e0 style USER fill:#181818,stroke:#00ff88,color:#e0e0e0

Step-by-Step Process

01
Understand the Directory Tree

Linux uses a single tree rooted at /. Learn the purpose of key directories.

# Key directories:
/bin   – essential user binaries
/etc   – system configuration
/home  – user home directories
/var   – variable data (logs, mail)
/tmp   – temporary files (cleared on reboot)
/proc  – virtual filesystem (kernel info)
/usr   – user programs and data
graph LR subgraph Filesystem Hierarchy Standard R[/] --> B[/bin\nBinaries] R --> E[/etc\nConfig] R --> H[/home\nUsers] R --> V[/var\nVariable] R --> P[/proc\nKernel] end
02
Navigate with cd and pwd

Move between directories using absolute paths (start with /) and relative paths (start with . or ..).

pwd              # print working directory
cd /etc          # absolute path
cd ..            # go up one level
cd ~/projects    # tilde = home dir
cd -             # go to previous dir
03
List and Inspect Files

Use ls with flags to get detailed file information including permissions, size, and modification time.

ls               # basic listing
ls -l            # long format
ls -a            # include hidden
ls -lah          # human sizes + hidden
ls -lt           # sort by time
file document    # detect file type
04
Create and Remove Directories

Build a project directory structure and clean it up.

mkdir labs               # single dir
mkdir -p lab1/data/raw   # nested dirs
rmdir empty_dir          # remove empty
rm -rf old_project       # remove recursively

Challenges & Solutions

  • Deleted files with rm -rf cannot be recovered — always double-check
  • rmdir only removes empty directories

Key Takeaways

  • Absolute paths always work regardless of current directory
  • Hidden files start with a dot — use ls -a to see them