The Linux file system is one of the most powerful and defining features of the Linux operating system. Unlike some operating systems that may abstract or simplify the underlying file structure, Linux offers a transparent, flexible, and unified file system architecture. Understanding how it works is essential for both everyday users and system administrators.
A file system (FS) is a method and data structure that an operating system uses to control how data is stored and retrieved. Without a file system, stored data would be one large body of data with no way to tell where one piece of information stops and the next begins.
In Linux, the file system is not just limited to physical hard drives. It’s a unified, hierarchical structure where everything is treated as a file: documents, directories, devices, and even processes.
Linux adheres to the Filesystem Hierarchy Standard (FHS), which defines the directory structure and content in Unix-like systems. At the core is the root directory, represented as a single forward slash `/`.
Here’s a high-level overview of essential top-level directories:
Linux supports several file types, all of which can be listed using `ls -l` with a type-indicating character at the beginning:
Each plays a unique role in the system's function, especially device and special files under `/dev`.
Every file in Linux is represented by an inode (index node). An inode contains metadata about the file:
Inodes do not store file names. The directory structure maps filenames to inode numbers. This separation allows for powerful features like hard links.
In Linux, everything exists under a single directory tree rooted at `/`. When a filesystem is mounted, it is attached to an existing directory (called a mount point).
Example mount command:
sudo mount /dev/sdb1 /mnt/external
Unmounting:
sudo umount /mnt/external
Persistent mounts are defined in `/etc/fstab`.
A storage device is often divided into partitions, each formatted with a file system type like `ext4` or `XFS`.
Examples:
This partitioning allows improved isolation and easier backups or reinstalls.
The most common Linux file system. Offers journaling, large volume support, and backward compatibility with ext3.
High-performance journaling file system, best for large files and high-throughput environments.
Next-gen file system with snapshots, compression, RAID support.
Windows-compatible file systems. Used for USB drives or dual-boot setups.
Used for virtual memory. Not a traditional file system.
Linux uses a permission model for each file and directory:
Each can have:
Example permission string:
-rwxr-xr--
Means:
Management commands:
Hard links point to the same inode. Deleting one does not remove the file as long as other links exist.
ln file1 file2
Symlinks point to a file path.
ln -s /path/to/original symlink
Can cross file systems. Often used for shortcuts or config management.
Contains device files. Examples:
Virtual FS with system and process info.
Examples:
Interface to kernel modules and devices.
Virtual file systems provide real-time, in-memory views of system status.
You can read/write these with tools like `cat`, `echo`, or `grep`.
The Linux file system is vast and elegant, adhering to a logical hierarchy while offering advanced features like virtual file systems, symbolic links, and permission-based access control. Everything in Linux—from hardware to processes—is accessed through this unified system.
Whether you’re managing devices, setting up partitions, or browsing log files in `/var`, understanding the Linux file system is fundamental to mastering the OS.