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

