Linux Filesystem Structure
Understanding the Linux filesystem is crucial for navigating and managing files effectively. Unlike Windows with drive letters (C:, D:), Linux has a single hierarchical tree starting from root (/).
The Root Directory
Everything in Linux starts from / (root):
/
├── bin - Essential command binaries
├── boot - Boot loader files
├── dev - Device files
├── etc - System configuration files
├── home - User home directories
├── lib - Essential shared libraries
├── media - Mount points for removable media
├── mnt - Temporary mount points
├── opt - Optional application software
├── proc - Process and kernel information
├── root - Root user's home directory
├── sbin - System binaries
├── srv - Service data
├── sys - System information
├── tmp - Temporary files
├── usr - User programs and data
└── var - Variable data (logs, databases)
Important Directories Explained
/home - User Home Directories
Each user has a directory under /home:
/home/
├── alice/
├── bob/
└── user/
The ~ symbol is a shortcut for your home directory.
/etc - Configuration Files
System-wide configuration:
/etc/
├── hosts - Hostname mappings
├── passwd - User account info
├── hostname - System hostname
└── ...
/var - Variable Data
Files that change frequently:
/var/
├── log/ - System logs
├── www/ - Web server files
└── tmp/ - Temporary files
Explore the Filesystem
Navigate through the filesystem using the terminal:
Paths: Absolute vs Relative
Absolute Paths
Start from root (/):
/home/user/documents/etc/hosts/var/log/syslog
Relative Paths
Start from current directory:
documents(if you're in /home/user)../bob(go up one level, then to bob)./script.sh(current directory)
Special Path Symbols
| Symbol | Meaning |
|---|---|
/ | Root directory |
~ | Home directory |
. | Current directory |
.. | Parent directory |
- | Previous directory |
Exercise: Understand Paths
Navigate to the /etc directory and list its contents:
Key Takeaways
- Linux uses a single hierarchical filesystem starting at /
/homecontains user directories/etccontains system configuration- Absolute paths start with /, relative paths don't
- Use
~for home,.for current,..for parent directory

