linuxlab.io
Tutorials▾
  • Linux & networking
    File system, processes, TCP/IP, BGP and OSPF
    →
  • Terraform & IaC
    HCL, state, plan/apply on a LocalStack sandbox
    →
  • Git & GitHub
    Object model, plumbing, branching, GitHub Actions
    →
All tutorials →
PricingAboutSign inCreate account
/
  • Introduction
  • Lessons
  • How it works
  • Simulator
  • Knowledge base
  • Interview prep
Index
Categories
All entries
Footer
linuxlab-TutorialsPricingAboutPrivacy & cookies
Copyright © 2026 LinuxLab. All rights reserved.
home/linux/kb/File system/fhs

kb/filesystem ── File system ── beginner

Filesystem Hierarchy Standard (FHS)

FHS is the standard for what lives in which Linux root directory: /etc holds config, /var holds changing data, /usr holds the distro's static files, /home holds users, /tmp holds temporary files.

view as markdownaka: filesystem-hierarchy, linux-directory-structure

Main directories

pathwhat is inside
/the root of everything; whatever does not fit the subdirectories below
/bin, /sbin, /usr/bin, /usr/sbinexecutable binaries (/usr/* is now unified with /)
/lib, /usr/libshared libraries and kernel modules (/lib/modules/)
/etcconfiguration. Text-based, read-only for applications by convention
/vardata that changes on a running system: logs, queues, databases, caches
/var/logservice logs
/var/lib/<pkg>persistent application state (postgres data, docker layers)
/var/run -> /runruntime state (PID files, UNIX sockets), tmpfs, gone on reboot
/usrread-only distro data: /usr/bin, /usr/lib, /usr/share, /usr/local
/usr/localsame as /usr but for software installed locally (outside the package manager)
/home/<user>user directories
/rootroot's home (kept apart from /home so root does not get stuck when /home is unmounted)
/tmptemporary files; usually cleared on reboot, sometimes tmpfs
/procvirtual FS that is an interface to the kernel and processes: /proc/self/, /proc/cpuinfo, /proc/sys/*
/syssame for devices, buses, cgroups, drivers (/sys/fs/cgroup, /sys/class/net)
/devdevices: /dev/null, /dev/zero, /dev/sda, /dev/pts/*
/bootkernel, initramfs, GRUB
/optoptional third-party packages that do not follow FHS (often vendor packages)
/srvservice data: content for a website, ftp, and so on
/mnt, /mediamount points for removable media and one-off mounts

The logic behind splitting /usr vs /var vs /etc

The split is not arbitrary. It gives you three different backup strategies:

  • /usr reinstalls from the repositories (you do not have to back it up)
  • /etc is small, text-based, and must be backed up
  • /var is large changing data, so you need an FS snapshot or a dump

Systems that break FHS

  • NixOS keeps everything in /nix/store/<hash>-name/, FHS is not used
  • Container images usually follow FHS, but with their "own" FS inside the container
  • macOS is POSIX, but adds /Applications, /System, /Users
  • Snap/Flatpak packages live in their own namespaces, seen as a normal FHS from inside

§ команды

bash
ls -la /

List the full set of root directories on your system

bash
df -h /

Check the free space on the root

bash
du -sh /var/log /etc /home 2>/dev/null

Compare the sizes of the main directories

bash
stat -f /tmp

-f: show info about the filesystem of this path (type, blocks, inodes)

§ см. также

  • inodeInodeAn inode is a filesystem record that holds metadata and pointers to a file's data blocks. The filename lives separately, in a directory, and simply points to the inode.
  • file-permissionsFile permissions: rwx and chmodEvery file has three permission sets: for the owner, the group, and others. Each set is three bits: read (r), write (w), execute (x). You change them with `chmod`.

§ упоминается в уроках

  • ›beginner-01-filesystem
  • ›beginner-02-directory-tree
  • ›beginner-02-files-and-text
  • ›beginner-10-packages-and-services
  • ›intermediate-08-disk-usage
Footer
linuxlab-
Copyright © 2026 LinuxLab. All rights reserved.
Tutorials
Pricing
About
Privacy & cookies