The Linux File System

Here's the first thing that trips people up: in Linux, everything is a file.

Not just documents and images. Everything. Devices, processes, network connections - all represented as files in a unified tree structure. Once you understand this, Linux makes a lot more sense.

The Tree Structure

Unlike Windows with its C:, D:, E: drives, Linux has a single tree that starts at the root: /

/                          ← Root (the top)
├── bin/                   ← Essential commands (ls, cp, mv)
├── boot/                  ← Boot loader files
├── dev/                   ← Device files
├── etc/                   ← Configuration files
├── home/                  ← User home directories
│   └── user/
│       ├── Documents/
│       ├── Downloads/
│       └── projects/
├── lib/                   ← System libraries
├── media/                 ← Removable media (USB, CD)
├── mnt/                   ← Temporary mount points
├── opt/                   ← Optional/third-party software
├── proc/                  ← Process information (virtual)
├── root/                  ← Root user's home
├── sbin/                  ← System binaries
├── tmp/                   ← Temporary files (cleared on reboot!)
├── usr/                   ← User programs
│   ├── bin/
│   ├── lib/
│   └── local/
└── var/                   ← Variable data (logs, cache)
    └── log/               ← Log files (check here first!)

Everything branches from /. Your USB drive? Mounted somewhere in this tree. A second hard drive? Also mounted in this tree. There's no "D: drive" concept.

Root Confusion

"Root" has two meanings in Linux:

  1. The root directory / (the top of the file tree)
  2. The root user (the superuser/admin)

Don't mix them up. When someone says "go to root," ask "the root directory or root user?"

Everything Is a File

This is the Unix philosophy that Linux inherited:

  • /dev/sda - Your hard drive (a file)
  • /dev/null - A black hole that discards everything (a file)
  • /proc/cpuinfo - Your CPU information (a file)
  • /etc/passwd - User accounts (a file)
Terminal
$# Yes, your CPU info is literally a file
$cat /proc/cpuinfo | head -5
processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 142 model name : Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz

This isn't just a weird quirk - it's powerful. It means you can use the same tools (cat, grep, less) to read hardware info, config files, and regular documents.

File Types

When you list files, you'll see different types:

SymbolType
-Regular file
dDirectory
lSymbolic link (shortcut)
cCharacter device
bBlock device
sSocket
pNamed pipe
Terminal
$ls -la /
drwxr-xr-x 19 root root 4096 Jan 14 10:00 . drwxr-xr-x 19 root root 4096 Jan 14 10:00 .. drwxr-xr-x 2 root root 4096 Jan 14 10:00 bin drwxr-xr-x 3 root root 4096 Jan 14 10:00 boot drwxr-xr-x 15 root root 3180 Jan 14 10:00 dev ...

See the d at the start? Those are directories.

Paths

A path is the address of a file in the tree.

/home/user/Documents/report.pdf

Read it left to right:

  • Start at root /
  • Go into home
  • Go into user
  • Go into Documents
  • There's report.pdf

Each / separates directory levels. The path uniquely identifies any file on the system.

Case Sensitivity

Linux is case-sensitive. This is important:

Documents/
documents/
DOCUMENTS/

These are three different directories. Unlike Windows, cd Documents and cd documents go to different places.

Watch Your Caps

I've seen people lose hours debugging "file not found" errors because they typed Config instead of config. Always double-check your capitalization.

No File Extensions Required

Linux doesn't care about file extensions. A file's type is determined by its content, not its name.

hljs bash
# This works perfectly fine:
mv script.sh script     # Remove the extension
./script                # Still runs as a bash script

Extensions are just a convention to help humans. The system uses other methods (like the file command) to identify file types.

Terminal
$file /bin/ls
/bin/ls: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV)...
$file /etc/passwd
/etc/passwd: ASCII text
Knowledge Check

In Linux, what does the `/` at the beginning of a path represent?

Key Takeaways

  • Linux has a single file tree starting at / (root directory)
  • Everything is a file - devices, processes, configs
  • Paths describe the location of files in the tree
  • Linux is case-sensitive (file and File are different)
  • File extensions are optional - content determines type

Next: let's understand the difference between absolute and relative paths. This is crucial for navigating efficiently.