Pcornel
Linux · Filesystem

Filesystem Hierarchy Standard (FHS)

Cheat sheet · https://pcornel.dk/topic.php?topic=2659

Back to the Topic

Answer

The Filesystem Hierarchy Standard (FHS) defines where things belong: /etc configuration, /var variable data and logs, /usr installed software, /home user data, /tmp temporary files, /opt add-on software, /boot kernel and bootloader files.

Remember

Put configuration in /etc, data in /var or /srv, local software in /usr/local or /opt — never edit files under /usr that packages own, they are overwritten on update. Many distributions merge /bin into /usr/bin.

First checks

  • dpkg -S <path> — which Debian package owns a file
  • rpm -qf <path> — which RPM owns a file
  • ls -ld <path> — owner, permissions and type
  • stat <path> — inode, links, size and timestamps
  • df -h <path> — filesystem and free space
  • findmnt <path> — which mount the path is on

Verify in this order

file type (config, data, log, program) → FHS directory → package or admin ownership

Where it usually breaks

First mismatch in hardware/block device → kernel driver/mapper/RAID/LVM → filesystem → mount namespace/options → path permissions/MAC → consumer I/O; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2659

Confirmation

Confirm action

Continue?