What Is the Linux Filesystem, and Why Does It Matter?
""
—
When you use a computer, all your files and programs are stored in particular places. Linux, a popular operating system, has a smart way of organizing these files. This is called the **Filesystem Hierarchy Standard**, or FHS for short. It helps the system know where to find important things, like settings, programs, and user files. this is very different from say, Microsoft WIndows, and can cause some confusion for those migrating to linux from Windows. Apple users will find it less puzzling, given that MacOS is based on BSD, another *nix.
Most versions of Linux follow this system so that everything works the same way. But some versions make small changes to improve speed, security, or how updates work. In this writeup, we'll look at how the Linux filesystem is organized, why some systems change it, and what that means for users.
below is a representation of the typical directory structure. It begins with the root ("/") of the filesystem, usually referred to as the top of the hierarchy. Think of other directories as being roots spreading out from the base of the tree.
/ # the 'root" of the filesystem, not the same as "/root" directory.
├── bin # Essential user binaries (e.g. ls, cp, mv) used in single-user mode
├── boot # Boot loader files (e.g. GRUB, kernel images like vmlinuz)
├── dev # Device files (e.g. /dev/sda, /dev/null) representing hardware
├── etc # System-wide configuration files
├── home # User home directories (e.g. /home/alice)
├── lib # Essential shared libraries for binaries in /bin and /sbin
├── lib64 # 64-bit versions of shared libraries (on 64-bit systems)
├── media # Mount points for removable media (e.g. USB drives, CDs)
├── mnt # Temporary mount point for mounting filesystems manually
├── opt # Optional software packages (e.g. third-party apps)
├── proc # Virtual filesystem for process and kernel information
├── root # Home directory for the root user
├── run # Runtime variable data (like PID files), cleared on reboot
├── sbin # Essential system binaries (e.g. init, ip, fdisk)
├── srv # Data for services provided by the system (e.g. web server files)
├── sys # Virtual filesystem exposing kernel and hardware info
├── tmp # Temporary files, often cleared on reboot
├── usr # Secondary hierarchy for read-only user data; contains most binaries and libraries
│ ├── bin # Non-essential user binaries (e.g. gcc, firefox)
│ ├── lib # Libraries for /usr/bin and /usr/sbin
│ ├── local # Local software installation (outside package manager control)
│ └── sbin # Non-essential system binaries for admin tasks
├── var # Variable data like logs, mail, spool files, databases
Most major Linux distributions use the Filesystem Hierarchy Standard (FHS), including Debian, Ubuntu Linux, Fedora Linux, Red Hat, CentOS, Arch Linux, SUSE, and Slackware. They follow it because it creates a consistent way to organise system files, making software development, maintenance, and user experience more predictable. Some distros do change or adapt the FHS for modern needs. For example, Fedora and Arch use a merged /usr layout where directories like /bin and /sbin are symlinked to /usr/bin and /usr/sbin. This makes the system easier for the developers to manage and it's better suited for things like read-only root filesystems, containers, and atomic updates.
Other distros like Alpine Linux and NixOS go further. Alpine simplifies the layout to stay small and fast for containers and embedded systems. NixOS doesn't follow FHS at all and uses a completely different structure based on its package manager to focus on reproducibility and isolation.
BSD/UNIX Filesystem
For comparison, BSD unices have their own philosophy which is unsurprisingly based on the Unix Filesystem Hierarchy\older UNIX standard:
/
├── bin # System binaries (BSD and Linux) — essential commands
├── sbin # System binaries (BSD and Linux) — administrative tools
├── boot
│ └── kernel # BSD kernel ___location
│ └── [Linux: /boot] # Linux stores kernel here
├── etc # Configuration files (BSD and Linux)
├── home # User directories
│ └── [BSD: /usr/home] # BSD may symlink /home to /usr/home
├── lib # Shared libraries
├── lib/modules # [Linux only] Kernel modules
├── media # Mount point for removable devices, common in Linux too.
│ └── [BSD: optional] # May not exist by default in BSD
├── mnt # Temporary mount point (both BSD and Linux)
├── tmp # Temporary files (cleared on reboot)
├── usr
│ ├── bin # User binaries (non-essential)
│ ├── sbin # User system binaries (non-essential)
│ ├── lib # Shared libraries
│ └── local # Optional/user-installed software
│ └── [Linux: /opt] # Linux may use /opt instead
├── var # Logs, mail, spools, runtime data
│ └── tmp # More persistent temporary files
└── modules # [BSD only] Kernel modules outside /boot
The BSD-based MacOS has its own, as can be seen below:
| Purpose | Linux (FHS) | macOS | Notes |
|-----------------------|--------------------|--------------------------------|-----------------------------------------------|
| System binaries | /bin, /sbin | /bin, /sbin | Present on both, mostly legacy on macOS |
| User binaries | /usr/bin | /usr/bin | Similar; macOS has SIP restrictions |
| Admin tools | /usr/sbin | /usr/sbin | Same purpose, but not all are user-accessible |
| Config files | /etc | /etc + /Library/Preferences | macOS also uses .plist files |
| Core system files | /lib, /boot | /System | /System is read-only in modern macOS |
| Shared libraries | /lib, /usr/lib | /usr/lib, /System/Library | Libraries split across writable and protected |
| User-installed apps | /opt, /usr/local | /Applications, /usr/local | /usr/local often used by Homebrew |
| User home dirs | /home | /Users | e.g., /home/alice vs /Users/Alice |
| Temporary files | /tmp | /tmp | Same path and purpose |
| Mount points | /mnt, /media | /Volumes | macOS mounts drives under /Volumes |
| Optional packages | /opt | /Applications | Apps are .app bundles stored in Applications |
$ xclip -o | wc -w
999