Skip to content

Linux Filesystem Hierarchy Standard (FHS): Every Directory Explained

The Linux Filesystem Hierarchy Standard (FHS) explained: what every top-level directory holds, from /bin, /etc and /usr to /var, /proc and /run, plus the merged /usr and where to put your own files.

Category
Linux
Covers
Disk Management
On this page

The Linux Filesystem Hierarchy Standard (FHS) defines where files belong on a Linux system: programs in one place, configuration in another, logs and other changing data somewhere else. Because almost every distribution follows it, you can log in to an Ubuntu, Debian, Fedora, RHEL or Arch machine and still know that settings are under /etc, logs under /var/log and user files under /home.

This guide explains every top-level directory in the Linux file system, what you should and shouldn’t store in each one, and how modern distributions have changed the classic layout with the merged /usr.

Linux Filesystem Hierarchy Standard (FHS) directory structure
Linux Filesystem Hierarchy Standard (FHS) directory structure

What Is the Filesystem Hierarchy Standard?

Linux doesn’t use drive letters like Windows. Everything, including extra disks, USB drives and network shares, hangs off a single tree that starts at the root directory, written as /. The FHS is the reference that says which directories exist under / and what goes in each.

The current version is FHS 3.0, published in 2015 by the Linux Foundation. The specification is now hosted and maintained by freedesktop.org. On systemd-based distributions, the file-hierarchy(7) manual page describes a modernised version of the same layout.

The FHS sorts files along two lines:

  • Static vs. variable: static files (programs, libraries, documentation) only change when you install or update software. Variable files (logs, caches, databases, mail) change while the system runs.
  • Shareable vs. unshareable: shareable files can be used by several machines, for example /usr on a network mount. Unshareable files are specific to one host, such as /etc and /boot.

That split explains most of the layout: /usr is static and shareable, /var is variable, and /etc is host-specific configuration.

Linux Directory Structure at a Glance

DirectoryContainsExample
/Root of the whole file system treeEverything else
/binEssential user commandsls, cp, cat
/bootKernel, initramfs and boot loader filesvmlinuz, grub/
/devDevice files/dev/sda, /dev/null
/etcSystem-wide configuration/etc/fstab, /etc/ssh/
/homeUsers’ home directories/home/rahul
/lib, /lib64Shared libraries and kernel moduleslibc.so.6, modules/
/mediaMount points for removable media/media/rahul/USB
/mntTemporary mount point for admins/mnt/backup
/optAdd-on software packages/opt/google/chrome
/procVirtual file system: processes and kernel info/proc/cpuinfo
/rootHome directory of the root user/root/.bashrc
/runRuntime data since the last bootPID files, sockets
/sbinSystem administration commandsfdisk, ip
/srvData served by this system/srv/www, /srv/ftp
/sysVirtual file system: devices and drivers/sys/class/net
/tmpTemporary files, often cleared at bootSession files
/usrInstalled programs, libraries and docs/usr/bin, /usr/share
/varVariable data: logs, caches, spools/var/log, /var/lib

Linux Directories Explained

/ – The Root Directory

Every path on a Linux system starts at /. Only the root user can create or delete entries directly under it. Don’t confuse the root directory / with /root, which is the root user’s home directory.

/bin – Essential User Commands

/bin holds the basic commands every user needs, even in single-user or rescue mode: ls, cp, mv, cat, bash and similar. On current distributions /bin is a symbolic link to /usr/bin (see the merged /usr below).

/boot – Boot Loader Files

/boot contains what the system needs before the kernel starts: the Linux kernel (vmlinuz-*), the initial RAM disk (initrd.img-* or initramfs-*) and the GRUB configuration in /boot/grub or /boot/grub2. On UEFI systems the EFI system partition is usually mounted at /boot/efi. Don’t delete files here by hand; let the package manager remove old kernels.

/dev – Device Files

Linux represents hardware and some special devices as files. /dev/sda and /dev/nvme0n1 are disks, /dev/sda1 is a partition, /dev/null discards anything written to it, /dev/zero returns zero bytes, and /dev/random and /dev/urandom return random data. The kernel and udev create these entries automatically.

/etc – Configuration Files

/etc is where system-wide configuration lives, as plain text files: /etc/fstab (file systems to mount), /etc/passwd and /etc/group (users and groups), /etc/hosts, /etc/ssh/sshd_config, /etc/nginx/ and so on. Programs don’t store binaries here. Back up /etc before you make big changes, because it holds most of what makes your server yours.

/home – User Home Directories

Each regular user gets a directory under /home, such as /home/rahul, which ~ expands to in the shell. Personal files and per-user settings (hidden dot files like ~/.bashrc and directories like ~/.config) live here. Many admins put /home on its own partition so a reinstall doesn’t touch user data.

/lib, /lib64 – Shared Libraries and Kernel Modules

Shared libraries needed by the programs in /bin and /sbin, such as the C library, live in /lib. 64-bit libraries are in /lib64 on Fedora and RHEL, and in /lib/x86_64-linux-gnu on Debian and Ubuntu. Kernel modules are in /lib/modules/<kernel-version>. Like /bin, these are symlinks into /usr on modern systems.

/media – Removable Media

Desktop environments mount USB drives, SD cards and DVDs here automatically, usually as /media/<username>/<label>. Some distributions use /run/media/<username> instead.

/mnt – Temporary Mount Point

/mnt is for file systems an administrator mounts by hand for a short time, for example a backup disk or an NFS share while you copy data:

sudo mount /dev/sdb1 /mnt

For permanent mounts, create a dedicated directory (such as /data or /srv/backup) and add it to /etc/fstab.

/opt – Optional Software

Self-contained third-party software that isn’t part of the distribution goes in /opt, each package in its own directory, for example /opt/google/chrome or a vendor’s monitoring agent. Its configuration belongs in /etc/opt and its variable data in /var/opt.

/proc – Process and Kernel Information

/proc is a virtual file system. Nothing in it is stored on disk; the kernel generates the contents when you read them. Each running process has a directory named after its PID, and files such as /proc/cpuinfo, /proc/meminfo and /proc/uptime report system information. Some files under /proc/sys can be written to change kernel settings, which is what sysctl does.

/root – Root User’s Home

The home directory of the root account. It sits directly under /, not in /home, so root can still log in when /home is on a separate partition that isn’t mounted.

/run – Runtime Data

/run was added in FHS 3.0. It’s a tmpfs (memory-based) file system that holds data describing the running system since the last boot: PID files, Unix sockets and lock files. Its contents disappear at every reboot. The older /var/run and /var/lock are now symlinks to it.

/sbin – System Binaries

/sbin holds commands for system administration, such as fdisk, mkfs, ip, reboot and fsck. Most need root privileges. On Fedora 42 and later, /usr/sbin has been merged into /usr/bin, so both paths point to the same files.

/srv – Service Data

Data that this machine serves to others, such as website files, FTP content or Git repositories, can go in /srv, for example /srv/www or /srv/git. Distributions leave it empty, and many web server packages still default to /var/www, so treat /srv as a convention you can choose to follow.

/sys – Devices and Drivers

Like /proc, /sys (sysfs) is virtual. It exposes the kernel’s view of devices, drivers and buses in a structured tree. For example, /sys/class/net lists network interfaces and /sys/block lists block devices. Tools like udev and lsblk read from here.

/tmp – Temporary Files

Any user or program can write temporary files to /tmp. Don’t store anything there that you need to keep. Many systems mount /tmp as tmpfs in RAM, so it’s emptied at every reboot. Fedora has done this for years, and Debian 13 does it by default on new installs, together with automatic cleanup of old files. Use /var/tmp for temporary files that should survive a reboot. Run findmnt /tmp to see how your system mounts it.

/usr – User Programs and Data

Despite the name, /usr isn’t for user files. It contains the bulk of the installed operating system and is meant to be read-only and shareable:

  • /usr/bin – most user commands
  • /usr/sbin – non-essential admin commands
  • /usr/lib – libraries and internal program files
  • /usr/include – C header files for development
  • /usr/share – architecture-independent data: documentation, man pages, icons, timezone data
  • /usr/local – software you compile or install yourself, outside the package manager. It has its own bin, lib, etc and share, so make install doesn’t overwrite distribution files.

/var – Variable Data

/var holds data that grows and changes while the system runs:

  • /var/log – log files, such as syslog, auth.log or messages, and the systemd journal in /var/log/journal
  • /var/lib – persistent state of programs: databases (/var/lib/mysql), Docker images (/var/lib/docker), the package database
  • /var/cache – cached data that can be regenerated, such as downloaded packages in /var/cache/apt
  • /var/spool – queues for mail, print jobs and cron
  • /var/tmp – temporary files kept across reboots
  • /var/www – web site files on many distributions (not part of the FHS itself)

When a server’s disk fills up unexpectedly, /var, usually /var/log or /var/lib/docker, is the first place to look.

The Merged /usr: Why /bin Is a Symlink

Historically, /bin, /sbin and /lib held the minimum needed to boot and repair a system, and /usr could live on a separate disk that was mounted later. Modern systems start with an initramfs that mounts /usr early, so that split no longer serves a purpose.

Most distributions have therefore merged /usr: the top-level directories are now symbolic links into /usr. This is the default on Fedora, RHEL 7 and later, Arch Linux, openSUSE, Debian 12 and later, and Ubuntu. You can check it yourself:

ls -l / | grep -- '->'

On Ubuntu 26.04 or Debian 13 the output looks like this:

lrwxrwxrwx   1 root root     7 Apr  2 10:15 bin -> usr/bin
lrwxrwxrwx   1 root root     7 Apr  2 10:15 lib -> usr/lib
lrwxrwxrwx   1 root root     9 Apr  2 10:15 lib64 -> usr/lib64
lrwxrwxrwx   1 root root     8 Apr  2 10:15 sbin -> usr/sbin

Paths like /bin/bash and /usr/bin/bash are the same file, so old scripts keep working. Fedora 42 went one step further and merged /usr/sbin into /usr/bin, which means the bin/sbin distinction is disappearing too.

Commands to Explore the Linux File System

List the top-level directories:

ls -l /

Show the tree one level deep (install the tree package first if needed):

tree -L 1 /

Read the hierarchy description that ships with your system:

man hier
man file-hierarchy

See which file systems are mounted where, including virtual ones like /proc, /sys and /run:

findmnt
df -h

Find which top-level directories use the most disk space:

sudo du -xh --max-depth=1 / 2>/dev/null | sort -h

Find which package installed a file (Debian/Ubuntu, then Fedora/RHEL):

dpkg -S /usr/bin/ssh
rpm -qf /usr/bin/ssh

Where Should You Put Your Own Files?

You want to store…Use
A script or program you wrote for all users/usr/local/bin
Software built from source/usr/local (default prefix of most build systems)
A self-contained vendor application/opt/<name>
Configuration for a service/etc/<name>
Application data, databases, state/var/lib/<name>
Application logs/var/log/<name>
Web site files/var/www or /srv/www
Personal filesYour home directory, /home/<user>
Scratch files you can lose/tmp

Avoid adding files to /usr/bin, /usr/lib or /bin by hand. The package manager owns those directories and may overwrite or remove your files during an upgrade.

Why the FHS Matters

A predictable layout benefits everyone. Packagers know where to install files, so software from different sources doesn’t collide. Administrators can write backup, monitoring and hardening rules once and apply them across distributions, for example backing up /etc, /home and /var/lib, or mounting /tmp with noexec. And when you move between Ubuntu, Debian, Fedora or RHEL, you already know where to look.

Conclusion

The Linux Filesystem Hierarchy Standard gives every file a predictable home: commands in /usr/bin, configuration in /etc, changing data in /var, user files in /home, and live kernel information in the virtual /proc and /sys. Modern distributions have simplified the classic layout by merging /bin, /sbin and /lib into /usr, but the meaning of each directory is the same. Run man hier on your own system to see the exact layout your distribution uses.

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

1 Comment

Leave a Reply

Your email address will not be published. Required fields are marked *


Back to top