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

