The Linux File System Explained, and the Distro Flavors Built on It
· Linux, Filesystem, FHS, Distros, Sysadmin
Linux folders look random when you are starting out. They are not. The short video above starts from a better rule: every well-known directory answers one question. Settings live in /etc. Data that grows while the machine runs lives in /var. People's files live in /home. Most of the programs you type live under /usr. Temporary files go in /tmp. Hardware shows up as files in /dev. Live process information is in /proc. The kernel's view of devices is in /sys. Runtime state since the last boot is in /run. And /, the root of the tree, is not the same place as /root, the home directory of the root user.
This article starts from those questions, then fills in the rest of the tree. The layout is the Filesystem Hierarchy Standard (FHS) 3.0, published by the Linux Foundation in 2015. Almost every mainstream distribution follows it, with one modern twist the video flags at the end: on most current systems, /bin and /lib are shortcuts into /usr. After the directory walk, we cover the filesystems those directories usually sit on — ext4, XFS, Btrfs, and ZFS — and the major Linux "flavors," meaning the distribution families and how they differ.
The short video at the top walks that map. This second clip covers the same directories from another angle — still the idea that each folder answers a question, including the modern detail that /bin, /sbin, and /lib may be links into /usr.
The map at a glance
| Path | The question it answers |
|---|---|
/ | Where does the whole tree start? |
/root | Where is the root user's home? |
/etc | Where are the system settings? |
/var | What is changing while the system runs? |
/home | Where do people keep their files? |
/usr | Where is most of the installed software? |
/tmp | What can I throw away? |
/dev | Where is the hardware, represented as files? |
/proc | What is running right now? |
/sys | What does the kernel see? |
/run | What has happened since this boot? |
/bin, /sbin, /lib, /lib64 | Where are the essential programs and libraries? (On modern systems, usually shortcuts into /usr.) |
/boot | Where are the files the machine needs to start? |
/opt | Where do add-on, often third-party, applications go? |
/srv | Where is data served by this machine? |
/media, /mnt | Where do we mount other filesystems? |
/ and /root are not the same place
Everything on a Linux system hangs off /, the root directory. A path that begins with / is absolute: it is measured from this root, not from the directory you happen to be in.
/root is different. FHS describes it as the home directory for the root user. It sits at the top of the tree, not under /home, so the administrator still has a home directory if /home is a separate volume that fails to mount. Do not treat /root as a synonym for /. The kernel and boot loader have to find a root filesystem before the rest of the system can start. Once it is mounted at /, the rest of the tree is attached underneath it.
/etc: where the settings are
/etc is host-specific system configuration. The video's summary is accurate: services, network setup, users, and the configuration files for most installed programs live here. FHS is explicit about one restriction: /etc must not contain binaries.
/etc/passwd, /etc/group, and /etc/shadow describe users and groups. /etc/fstab lists filesystems that should be mounted at boot. Package managers drop their defaults here too: /etc/apt on Debian and Ubuntu, /etc/dnf or /etc/yum.repos.d on the Red Hat family, /etc/pacman.conf on Arch, /etc/apk on Alpine. Treat /etc as something you change carefully and back up.
/var: what is changing right now
/var holds variable data: logs, caches, databases, mail and print queues, and other files that grow while the system runs. If a service is misbehaving, /var/log is the first place to look.
/var/log: log files and directories. On systemd systems you will also query the journal withjournalctl, but many services still write text logs here./var/cache: cached data a program can regenerate. It can usually be deleted when you need space./var/lib: persistent state — package databases, systemd state, and many application databases./var/spool: queues waiting for later processing, such as mail or print jobs./var/tmp: temporary files that must survive a reboot. FHS requires that this directory not be wiped at boot, and recommends less frequent cleanup than/tmp./var/mail: user mailboxes, when the system delivers local mail this way. Some systems still use/var/spool/mail./var/optand/var/local: variable data for software in/optand/usr/local.
Two historical paths are now usually shortcuts: /var/run typically links to /run, and /var/lock to /run/lock. /var/www is a common web-content default on Debian and Ubuntu, but that is a distribution convention; FHS prefers /srv for site-specific service data. Because /var grows, it is a common choice for its own partition.
/home and /tmp
Every ordinary user typically gets a directory under /home, named after the account, for files, downloads, and personal settings (often hidden "dotfiles" such as .bashrc or .config). FHS lists /home as optional, but almost every desktop and multi-user server has it. Administrators often put /home on a separate volume so a system reinstall does not wipe user data.
/tmp is for temporary files. Never store anything important there. FHS says programs must not assume that anything in /tmp will still be there the next time they run. It recommends, but does not require, that /tmp be cleared at boot; many systems do so with systemd-tmpfiles, or mount /tmp as a tmpfs. /tmp is usually world-writable, with the sticky bit set so users cannot delete each other's files. /var/tmp is the place for temporary data that has to survive a reboot.
/dev, /proc, /sys, and /run
Linux exposes devices as special files under /dev. Disks appear as names like /dev/sda or /dev/nvme0n1. The video mentions /dev/null, a special file that discards anything written to it. On a modern system these nodes are not static files on disk: the kernel and udev (or an equivalent such as Alpine's mdev) create and remove them as hardware appears and disappears. Treat them as interfaces to the kernel, not as documents you edit.
/proc is not on your disk. The kernel builds it live, with a directory for every running process named by its process ID, plus files such as /proc/cpuinfo and /proc/meminfo. /proc/sys holds tunables you can read or, carefully, write. /sys is another virtual filesystem, sysfs, showing devices, drivers, buses, and power management. /proc is process- and kernel-parameter oriented; /sys is device- and driver-oriented.
/run holds runtime data since the last boot: process ID files, transient UNIX-domain sockets, and early udev data. FHS 3.0 requires that files under /run be cleared at the beginning of the boot process. In practice it is almost always a tmpfs, so a reboot wipes it automatically. Most distributions make the older path, /var/run, a symbolic link to /run. /run itself should not be writable by unprivileged users.
/bin, /sbin, /lib, /lib64, and the /usr merge
Historically, /bin held essential user commands needed to boot or repair the system — sh, ls, cp, mount, and the like. /sbin held essential system binaries such as fsck, mkfs, and ip. /lib held the shared libraries and kernel modules those programs depend on. On 64-bit systems, /lib64 (an FHS "alternate format" library directory) often held the 64-bit libraries.
That split existed so a small root filesystem could boot before /usr was mounted. Initramfs images made that constraint much less important. The modern layout, which the video calls out, is the /usr merge: on most current distributions, /bin, /sbin, /lib, and /lib64 are symbolic links into the matching directories under /usr. Fedora merged /usr in Fedora 17. Arch Linux did it in 2012–2013. Debian made a merged /usr required in Debian 12, and Debian 13 finished moving packaged files to their /usr locations while leaving the compatibility links in place. Ubuntu follows the same model. Familiar paths such as /bin/sh still work because the links preserve them.
/usr: where the programs are
Despite the letters, /usr is not where user home directories live. That is /home. FHS treats /usr as the secondary hierarchy: a shareable, usually read-only tree that holds most of the installed operating system, with everyday commands inside /usr/bin.
/usr/bin: most user commands. After the/usrmerge, this is also what/binpoints at./usr/sbin: non-essential system binaries. After the merge,/sbinpoints here./usr/liband/usr/lib64: libraries, plugins, and often kernel modules under/usr/lib/modules./usr/libexec: programs meant to be run by other programs, not typed by users (optional in FHS)./usr/include: header files for compiling software./usr/share: architecture-independent data: manual pages, documentation, icons, and locales./usr/src: source code, often the kernel source or headers./usr/local: the local hierarchy, for software you install yourself.
/usr is supposed to be safe to mount read-only in production. Configuration belongs in /etc, and variable data belongs in /var. /usr/local is for software the administrator installs locally, so a system update does not overwrite it. FHS says that software must go under /usr/local rather than /usr, unless you are deliberately replacing something in /usr. The directory mirrors the /usr layout. A default ./configure && make && make install often lands in /usr/local/bin. Distribution packages stay in /usr; third-party bundled applications often choose /opt.
/boot, /opt, /srv, /media, and /mnt
/boot holds the static files the boot loader needs: the kernel image, the initramfs or initrd, and boot-loader configuration such as GRUB's files. It is often a separate partition, especially on encrypted systems. On UEFI machines, the EFI System Partition is commonly mounted at /boot/efi and is a FAT filesystem, a firmware requirement rather than a Linux preference.
/opt is for add-on application software packages, usually /opt/<package> or /opt/<provider>/<package>, with variable data in /var/opt. Self-contained third-party products often live here.
/srv is for data served by this system, such as web or FTP content. FHS does not dictate the layout under /srv; that is site policy. A common pattern is /srv/www or /srv/<service>.
/media is the mount point for removable media, often mounted automatically as /media/<user>/<label>. /mnt is a temporary mount point for an administrator. You may also see directories that are not in FHS 3.0: /lost+found on ext filesystems, used by fsck; /snap on Ubuntu; /nix on NixOS or on other systems that have Nix installed. Those are distribution or product conventions, not part of the standard map.
Filesystem types: what the directories sit on
The hierarchy above is a directory standard. Underneath it is a disk filesystem, and distributions do not all pick the same default.
ext4 is the default on Debian and Ubuntu. It is a mature, journaled Linux filesystem, and it can grow online and shrink offline with resize2fs. It is the conservative, well-tested choice for a general-purpose root filesystem.
XFS has been the default root filesystem on Red Hat Enterprise Linux since RHEL 7, and therefore on RHEL-compatible distributions such as Rocky Linux and AlmaLinux. It scales well to large volumes and parallel I/O, and it can grow online, but it cannot be shrunk in place.
Btrfs is a copy-on-write filesystem with snapshots, checksums, and optional transparent compression. Fedora desktop editions have used it by default since Fedora 33. openSUSE commonly uses Btrfs for the root filesystem, often with Snapper snapshots around updates so you can roll back. Red Hat removed Btrfs from RHEL 8, so Fedora's desktop default and RHEL's default are different.
ZFS, through OpenZFS, offers checksums, snapshots, and RAID-Z, among other integrity features. It is not in the mainline Linux kernel because of a license conflict between the CDDL and the GPL, so it is provided out of tree. Ubuntu can install onto ZFS as an option, but it is not the default. You will also see tmpfs for in-memory filesystems such as /run, vfat or FAT32 for the EFI System Partition, and swap for swap space.
Linux flavors: the distribution families
"Linux" is the kernel. A flavor is a distribution: the kernel plus a userspace, a package manager, a release model, and a set of defaults. The directory tree above is shared. The tools you use to change it are not.
Debian family (apt, .deb): Debian is conservative, with stable point releases. Ubuntu is Debian-based, with a more frequent cadence and an LTS release every two years; Linux Mint is Ubuntu-based (LMDE is Debian-based). Look for /etc/apt and /var/lib/dpkg; Ubuntu also adds /snap, which is not in FHS.
Red Hat family (dnf, .rpm): Fedora is the upstream, with a short release cycle. RHEL is the commercial long-support product; Rocky Linux and AlmaLinux are widely used RHEL-compatible rebuilds after CentOS shifted to CentOS Stream. Repositories live under /etc/yum.repos.d or /etc/dnf. SELinux is typically enforcing.
SUSE also uses RPM, but the manager is zypper and the admin tool is YaST. openSUSE Leap aligns with SUSE Linux Enterprise; Tumbleweed is rolling. Btrfs on the root filesystem with Snapper snapshots is more visible here, so a failed upgrade can be rolled back.
Arch Linux uses pacman and a rolling-release model. Official repositories are relatively lean; the Arch User Repository (AUR) is a huge community overlay of build recipes. Manjaro and EndeavourOS keep pacman but add their own installers and defaults.
Alpine Linux is built for small images, especially containers. Its package manager is apk, it uses musl rather than glibc, and the default init system is OpenRC, not systemd. The tree follows FHS, but the userspace is minimal; BusyBox often provides many everyday commands.
Gentoo is source-based. Portage builds packages from ebuilds, with USE flags to turn features on or off. The layout is still FHS, but you control what gets installed into /usr. Gentoo can use systemd or OpenRC.
Other flavors extend, or break, the map. Slackware is the oldest surviving distribution, with a simple package tool set. NixOS is a larger departure: /nix/store holds immutable package trees, and many familiar FHS paths are built from those store paths. Immutable systems such as Fedora Silverblue use OSTree to deliver the OS as an image, which is one reason the /usr merge matters.
| Family | Package manager | Format | Release model | Typical use |
|---|---|---|---|---|
| Debian / Ubuntu / Mint | apt / dpkg | .deb | Point releases; Ubuntu LTS every 2 years | Servers, desktops, cloud |
| Fedora / RHEL / Rocky / Alma | dnf | .rpm | Fedora: frequent; RHEL and compat: long support | Enterprise servers; Fedora upstream |
| SUSE / openSUSE | zypper | .rpm | Leap: point releases; Tumbleweed: rolling | Enterprise; desktops that want rollback |
| Arch / Manjaro | pacman | Arch packages | Rolling | Desktops; current software |
| Alpine | apk | .apk | Stable and edge branches | Containers and small systems |
| Gentoo | Portage | ebuilds (source) | Rolling, source-built | Custom, source-built systems |
Is the Linux layout random? Why some folders look inconsistent
A reasonable reaction to this topic is that Linux folders can look "largely random," with the same kinds of files turning up in more than one place: /bin and /usr/bin, /sbin and /usr/sbin, /usr/local and /opt. That observation is fair. The layout is not random, but it is not a clean design drawn on a blank page either. It is a set of rules built on top of a 1970s accident, then kept for compatibility, then slowly cleaned up.
The historical /bin vs /usr/bin split
The best-known account of how the split started is Rob Landley's 9 December 2010 post to the BusyBox mailing list. Ken Thompson and Dennis Ritchie created Unix on a PDP-7 in 1969. Around 1971 they moved to a PDP-11 with a pair of RK05 disk packs, about 1.5 megabytes each. When the operating system outgrew the first pack — the root filesystem — they let it spill onto the second pack, which already held user home directories. That second mount was called /usr. They replicated the OS directories under it (/usr/bin, /usr/sbin, /usr/lib, and so on) because the original disk was out of space. When a third disk arrived, user homes moved to /home, and /usr became more operating-system space.
They also made a practical rule: the system had to come up far enough to mount the second disk, so commands like mount could not live only on /usr. That is the origin of "essential" tools on the root filesystem and everything else under /usr. Landley's point is that this was a 1970s implementation detail, fairly specific to that machine, that was then carried forward for decades. Initramfs later took over early boot, shared libraries made / and /usr hard to upgrade independently, and disks got large enough that the original space problem disappeared. The split stopped being necessary before Linux existed. The names stayed.
/sbin vs /bin, and /usr/local vs /opt
Once the split existed, later rules were written to justify and extend it. FHS still describes /bin as essential user commands and /sbin as essential system binaries, typically used by the administrator. In practice the line is messy. Tools in /sbin are often on a regular user's PATH, and a program that starts as "root only" can become useful to everyone without ever moving. Arch Linux went further than most and merged /bin, /sbin, and /usr/sbin into a single /usr/bin. Other distributions keep /usr/sbin as a separate directory even after the /usr merge.
The same kind of layering produced /usr/local and /opt. After /usr became "the operating system," /usr/local became the place for software the local administrator installs, so a vendor or distro update does not overwrite it. FHS still says that. Later, add-on and third-party packages that wanted their own tree — /opt/<package> or /opt/<provider>/<package> — got /opt. Landley jokes in that same 2010 post that he is still waiting for /opt/local. The two directories are not random, but they are a historical stack: two answers to "where do I put software that is not part of the distro?"
FHS is a standard, not a law
The Filesystem Hierarchy Standard 3.0, published by the Linux Foundation in 2015, is the document most distributions use to keep /etc, /var, /usr, /home, and the rest recognizable from one system to another. It is a real architectural standard. It is not enforced. There is no central Linux authority that can fail a distro for putting web content in /var/www instead of /srv, or for adding /snap or /nix. Linux is an ecosystem of distributions, not a single operating system. "Most" systems follow FHS because interoperability is useful, not because compliance is mandatory. Some systems, such as NixOS, deliberately depart from the traditional tree.
The cleanup is real, and it is still uneven
The /usr merge, covered earlier in this article, is the main effort to undo the old split: /bin, /sbin, /lib, and /lib64 become symbolic links into /usr. That is now the expected layout, but distributions got there on different schedules:
- Fedora 17 (2012) was an early mover, under the name UsrMove.
- Arch Linux turned
/libinto a symlink in 2012 and finished moving binaries into/usr/binin June 2013. - Red Hat Enterprise Linux 7 introduced the same merged layout, with
/binlinking to/usr/binand so on. RHEL 8 and RHEL 9 keep it. (The merge landed in RHEL 7, not only in RHEL 9.) - Debian made a merged
/usrrequired in Debian 12 ("bookworm"), and Debian 13 finished moving packaged files to their/usrlocations. Ubuntu follows the same model.
systemd's file-hierarchy(7) goes a step further. It describes a modernized, tighter subset of the older Unix and FHS layout for systems that run systemd: vendor-supplied operating system files belong under /usr, host configuration in /etc, persistent variable data in /var, and runtime data in /run. In that document, legacy paths such as /bin, /sbin, and /usr/sbin are compatibility symlinks into /usr/bin. Not every distribution follows that last detail — Debian and RHEL typically keep /sbin as a link to /usr/sbin rather than collapsing it into /usr/bin — but the direction is the same. systemd will also taint a system whose /usr is not merged. That is an ongoing standardization effort, not a claim that every distribution already looks identical.
Flexibility is not the same as no design
So the comment is half right. Things really do live in more than one place, and some of that is leftover inconsistency: a disk that ran out of space in 1971, later rules written to justify the split, distribution-specific extras, and a multi-year cleanup that did not land everywhere at once. What it is not is a lack of architecture. /etc is still configuration, /var is still variable data, /home is still user files, and FHS plus systemd's hierarchy document are why a Debian admin can still find their way around a Fedora or Arch machine. There is a significant difference between architectural flexibility — and a long compatibility tail — and the absence of architecture.
If you want more walkthroughs like this, follow @rankcore.ai and browse the rest of the guides on blog.rankcore.ai.
Want to go deeper?
Our step-by-step video courses turn these ideas into results.
Comments
No comments yet — be the first.