Filesystem Fundamentals · #6 of 19

The Filesystem Hierarchy

Everything is a File

The Root of Everything

Unlike Windows (C:, D:, E:), Linux has a single root directory: /

Everything — files, directories, devices, processes — lives under this one tree.


The Filesystem Hierarchy Standard (FHS)

/                           # Root — the top of the tree
├── bin/                    # Essential binaries (ls, cp, cat)
├── boot/                   # Bootloader and kernel
├── dev/                    # Device files (disks, terminals)
├── etc/                    # Configuration files
├── home/                   # User home directories
│   └── username/           # Your files live here
├── lib/                    # Shared libraries
├── media/                  # Mounted removable media (USB drives)
├── mnt/                    # Temporary mount points
├── opt/                    # Optional/third-party software
├── proc/                   # Virtual filesystem (process info)
├── root/                   # Root user's home directory
├── run/                    # Runtime data (PIDs, sockets)
├── sbin/                   # System binaries (admin commands)
├── srv/                    # Service data (web server files)
├── sys/                    # Virtual filesystem (hardware info)
├── tmp/                    # Temporary files (cleared on reboot)
├── usr/                    # User programs and data
│   ├── bin/                # User binaries
│   ├── lib/                # User libraries
│   └── share/              # Shared data (docs, icons)
└── var/                    # Variable data (logs, databases)
    └── log/                # System logs

Key Directories Explained

/home — Your Home

Your personal space. Configuration, documents, downloads all go here.

/etc — Configuration

System-wide settings. All plain text files.

/var — Variable Data

Data that changes during operation.

/dev — Devices

Hardware represented as files.

/proc and /sys — Virtual Filesystems

Not real files! The kernel generates these on-the-fly.

cat /proc/cpuinfo      # CPU information
cat /proc/meminfo      # Memory information
cat /sys/class/power_supply/BAT0/capacity  # Battery level

“Everything is a File”

This is Linux’s most powerful abstraction:

ThingFile Path
Hard disk/dev/sda
USB drive/dev/sdb1
Terminal/dev/tty1
Random numbers/dev/random
Null (discard)/dev/null
Process info/proc/[pid]/
CPU temp/sys/class/thermal/

This means you can use the same tools (cat, echo, read) for everything!


Absolute vs Relative Paths

Absolute path: Starts from root (/)

cd /home/user/Documents

Relative path: Starts from current location

cd Documents        # If you're in /home/user
cd ../Downloads     # Go up one, then into Downloads

Special Directories


# Where am I?
pwd

# What's here?
ls

# Go to root
cd /

# Explore!
ls /etc
ls /var/log
cat /etc/os-release

# Go home
cd ~
# or just
cd