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
Up next ยท Lesson 5 of 40
Print Working Directory (pwd)
1 min read
4 of 40 lessons done

