Lesson 03 — Linux File System
Lesson Overview
Section titled “Lesson Overview”Unlike Windows, Linux doesn’t use drive letters such as **C:*, **D:*, or **E:**.
Instead, Linux organizes everything into a single hierarchical directory structure that begins at the Root Directory (/).
In Linux:
- Files
- Directories
- Hard disks
- USB drives
- Network storage
- Running processes
- Devices
are all represented as files within this hierarchy.
Understanding the Linux File System is one of the most important skills for Linux administrators, Cloud Engineers, DevOps Engineers, and Cybersecurity Professionals.
Throughout your Linux career, you’ll constantly work with directories, configuration files, logs, applications, and storage—all of which are organized within the Linux File System.
Learning Objectives
Section titled “Learning Objectives”After completing this lesson, you will be able to:
- Understand the Linux File System Hierarchy.
- Navigate Linux directories.
- Identify important system directories.
- Understand absolute and relative paths.
- Explore common file management commands.
- Understand where Linux stores configuration files, logs, applications, and user data.
What is a File System?
Section titled “What is a File System?”A File System defines how an operating system stores, organizes, and retrieves files.
It provides a structured way to organize:
- Files
- Directories
- Storage Devices
- Permissions
- Metadata
Without a file system, the operating system would not know where files are stored.
Linux File System Hierarchy
Section titled “Linux File System Hierarchy”Linux follows the Filesystem Hierarchy Standard (FHS).
Everything begins from a single directory:
/This is called the Root Directory.
Every other directory exists underneath it.
Linux Directory Structure
Section titled “Linux Directory Structure”/
├── bin
├── boot
├── dev
├── etc
├── home
├── lib
├── media
├── mnt
├── opt
├── proc
├── root
├── run
├── sbin
├── srv
├── sys
├── tmp
├── usr
└── varUnderstanding these directories is essential for Linux administration.
Root Directory (/)
Section titled “Root Directory (/)”The Root Directory is the top-level directory in Linux.
Everything starts here.
Example:
/Think of it as the parent of every directory in the operating system.
The /home directory stores user files.
Example:
/home
├── student
├── alice
└── bobEach user has their own personal directory.
Typical contents include:
- Documents
- Downloads
- Desktop
- Pictures
- Configuration Files
The /root directory is the home directory of the root (administrator) user.
Example:
/rootDo not confuse / with /root.
They are completely different.
The /etc directory stores system configuration files.
Examples:
/etc/passwd
/etc/hosts
/etc/fstab
/etc/ssh/Most Linux administration tasks involve modifying files in /etc.
Contains essential user commands.
Examples:
ls
cp
mv
cat
pwdThese commands are available even during system recovery.
Contains essential administrative commands.
Examples:
reboot
shutdown
mount
fdiskPrimarily used by system administrators.
Stores applications and user programs.
Example:
/usr/bin
/usr/lib
/usr/shareMost installed software resides here.
Stores data that changes frequently.
Examples:
Logs
Mail
Cache
Databases
Print QueuesOne of the most important directories is:
/var/logSystem logs are stored here.
Temporary files.
Applications use this directory while running.
Files may be automatically removed after reboot.
Contains files required to start Linux.
Examples:
- Linux Kernel
- Boot Loader
- Initial RAM Disk
Without /boot, Linux cannot start.
Linux treats hardware devices as files.
Examples:
/dev/sda
/dev/sdb
/dev/null
/dev/randomHard disks, USB devices, and other hardware appear here.
A virtual file system containing information about running processes and the Linux kernel.
Examples:
/proc/cpuinfo
/proc/meminfo
/proc/versionUseful for troubleshooting and system monitoring.
Provides information about hardware devices and kernel settings.
System administrators use this directory for advanced hardware management.
Stores optional third-party applications.
Examples:
/opt/google
/opt/docker
/opt/customappMany enterprise applications install files here.
/media
Section titled “/media”Used when removable media is automatically mounted.
Examples:
- USB Drives
- DVDs
- External Hard Drives
Temporary mount point used by administrators.
Example:
/mnt/backup
/mnt/storageCommonly used during maintenance.
Absolute Paths
Section titled “Absolute Paths”An Absolute Path begins from the Root Directory.
Example:
/home/student/Documents/file.txtAbsolute paths always begin with:
/Relative Paths
Section titled “Relative Paths”A Relative Path begins from the current directory.
Example:
Documents/file.txtRelative paths do not begin with /.
Current Working Directory
Section titled “Current Working Directory”Display your current location.
Command:
pwdExample:
/home/studentListing Files
Section titled “Listing Files”Display files and directories.
Command:
lsDisplay detailed information.
ls -lDisplay hidden files.
ls -laChanging Directories
Section titled “Changing Directories”Move into another directory.
cd /homeReturn to your home directory.
cdMove up one directory.
cd ..Move to the previous directory.
cd -Viewing Directory Contents
Section titled “Viewing Directory Contents”Display the contents of a directory.
Example:
ls /etcExample output:
passwd
hosts
ssh
fstabHidden Files
Section titled “Hidden Files”Linux hides files beginning with a period.
Examples:
.bashrc
.profile
.gitconfigDisplay hidden files:
ls -laLinux File Types
Section titled “Linux File Types”Linux supports several file types.
| Type | Description |
|---|---|
| Regular File | Standard file |
| Directory | Folder |
| Symbolic Link | Shortcut |
| Character Device | Keyboard, Terminal |
| Block Device | Hard Disk |
| Socket | Network Communication |
| Named Pipe | Process Communication |
File System in Cloud Computing
Section titled “File System in Cloud Computing”Cloud virtual machines also use the Linux File System.
Example:
AWS EC2
↓
Ubuntu
↓
/etc
↓
Configuration Files
↓
Application StartsCloud administrators regularly manage these directories.
File System in Cybersecurity
Section titled “File System in Cybersecurity”Security professionals investigate:
- Log Files
- User Directories
- SSH Configuration
- Authentication Logs
- Malware Files
Common investigation locations:
/var/log
/etc
/home
/tmpUnderstanding the Linux File System is critical during incident response.
Common Commands
Section titled “Common Commands”Display current directory:
pwdList files:
lsChange directory:
cdDisplay directory tree (if installed):
treeDisplay disk usage:
df -hDisplay mounted file systems:
mountThese commands are used daily by Linux administrators.
Real-World Example
Section titled “Real-World Example”A Cloud Engineer deploys a web server.
Ubuntu Server
↓
/etc/nginx
(Configuration)
/var/log/nginx
(Log Files)
/usr/sbin/nginx
(Application Binary)
/var/www/html
(Website Files)Knowing the Linux File System makes troubleshooting much easier.
Best Practices
Section titled “Best Practices”As a Linux administrator:
- Learn the purpose of each major directory.
- Keep user data under /home.
- Avoid modifying system files unnecessarily.
- Store logs under /var/log.
- Back up configuration files before making changes.
- Use absolute paths in automation scripts.
- Keep temporary files in /tmp.
- Organize applications consistently.
A well-organized file system simplifies administration and troubleshooting.
Key Takeaways
Section titled “Key Takeaways”After completing this lesson, you should understand:
- The Linux File System Hierarchy Standard (FHS).
- The purpose of major Linux directories.
- Absolute vs relative paths.
- Basic navigation commands.
- Common file types.
- How Linux organizes applications, configuration files, logs, and user data.
Summary
Section titled “Summary”The Linux File System provides a standardized and organized way to store and manage files across the operating system.
Unlike Windows, Linux organizes everything beneath a single Root Directory, making navigation consistent across distributions.
Whether you’re managing cloud servers, troubleshooting applications, analyzing security incidents, or automating infrastructure, a solid understanding of the Linux File System is essential.
Mastering the Linux directory structure will make every future administration task easier.
Next Lesson
Section titled “Next Lesson”➡️ Lesson 04 — Linux Users & Groups
In the next lesson, you’ll learn how Linux manages users and groups, understand authentication and authorization, create user accounts, assign permissions, and explore best practices for identity management in Linux systems.