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:
- The root directory
/(the top of the file tree) - 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)
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:
| Symbol | Type |
|---|---|
- | Regular file |
d | Directory |
l | Symbolic link (shortcut) |
c | Character device |
b | Block device |
s | Socket |
p | Named pipe |
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.
# 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.
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 (
fileandFileare 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.