Module 2: Filesystem Structure
The Linux filesystem is a hierarchical structure that organizes all files and directories on your system. Understanding this structure is essential for navigating and managing your Linux environment effectively.
Key Concept: In Linux, everything is treated as a file - even devices, processes, and system information are represented as files in the filesystem.
What You'll Learn in This Module
- The Linux Filesystem Hierarchy Standard (FHS)
- Purpose of key system directories
- How to navigate the filesystem efficiently
- The "everything is a file" philosophy in practice
- File paths: absolute vs. relative
Module Objectives
By the end of this module, you will be able to:
- Explain the purpose of major directories in the Linux filesystem
- Navigate between directories using absolute and relative paths
- Understand how devices and processes are represented as files
- Use essential filesystem navigation commands
- Locate different types of files on the system
Why This Matters
Understanding the filesystem structure is crucial because:
- Efficiency: You'll quickly find files and directories without guessing
- Troubleshooting: Many system issues involve locating the right configuration files
- Security: Understanding permissions and locations helps secure your system
- Development: Web development often involves working with specific directories
The Filesystem Hierarchy
Linux follows the Filesystem Hierarchy Standard (FHS), which defines the directory structure and contents. Here's an overview of the most important directories:
/
├── bin/ # Essential user binaries
├── sbin/ # System binaries
├── etc/ # Configuration files
├── dev/ # Device files
├── proc/ # Process information
├── var/ # Variable data
├── home/ # User home directories
├── usr/ # User programs
├── tmp/ # Temporary files
├── opt/ # Optional software
├── boot/ # Boot loader files
├── lib/ # System libraries
└── root/ # Root user home
Key Directories and Their Purposes
System Directories
- /bin - Essential command binaries (ls, cp, mv, etc.)
- /sbin - System administration binaries
- /etc - System configuration files
- /lib - Essential system libraries
- /boot - Boot loader files and kernel
User Directories
- /home - User home directories
- /usr - User programs and data
- /opt - Optional software packages
- /tmp - Temporary files
Runtime Directories
- /dev - Device files
- /proc - Process and system information
- /var - Variable data (logs, spool, etc.)
- /run - Runtime data
Memory: Think of / as the trunk of a tree, with each directory as a branch. Understanding this tree structure helps you navigate efficiently.
Getting Started
Ready to explore the Linux filesystem? Start with the first lesson about the filesystem hierarchy structure.
Quick Terms to Know
Here are some terms we'll be using throughout this module:
- Root Directory: The top-level directory (/)
- Home Directory: Your personal directory (~)
- Working Directory: Your current location
- Path: The route to a file or directory
- Mount Point: Where a filesystem is attached
Don't memorize everything! Focus on understanding the most common directories (/home, /etc, /var, /usr). You'll become familiar with others through practice.
Linux 101