Lesson 03 β Linux File System
Lesson 03 β Linux File System
Section titled β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.
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.