FHS (File Hierarchy System) on Unix-like operating systems such as Linux

The Linux file system can seem a little strange especially for those coming from an M$ Windoze background. This is my humble attempt at debunking it and perhaps making it a little easier to understand.

Several main differences…

There are some important differences between the DOS/Windows type file system and the system used by Unix-derived systens such as Linux and Macintosh OSX.

  1. Folder delimiter is a forwardslash  “/” not a backslash “\”.
  2. Disk drives do not have drive letters. Instead they are mounted from within the file hierarchy system.
  3. File and folder names are case sensitive.
  4. Files and folders are hidden by adding a preceding dot.
  5. File and folder permissions are completely different.
  6. Unixy folks often refer to “folders” as “directories”.
  7. The shorthand to access the current user’s home folder is ~/ In my case ~/ is the same as /home/garf

Basic FHS

(Note this deviates slightly from official FHS by including some Debian-based paths as well.)

Primary hierarchy root and root directory of the entire file system hierarchy.

Essential command binaries that need to be available in single user mode; for all users (e.g., cat, ls, cp).

Boot loader files (e.g., kernels, initrd). Often a separate partition.

Essential devices (e.g., /dev/null).

Host-specific system-wide configuration files (the name comes from et cetera).

Configuration files for /opt/.

Configuration files for the X Window System, version 11.

Configuration files for SGML.

Configuration files for XML.

Users’ home directories – containing saved files, personal settings etc. Often a separate disk partition.

Where my stuff lives. (Not actuallly part of the official FHS – obviously)

Libraries essential for the binaries in /bin/ and /sbin/.

Mount points for removable media such as CD-ROMs (appeared in FHS version 2.3).

Temporarily mounted filesystems.

Optional application software packages.

Virtual filesystem documenting kernel and process status as text files (e.g., uptime, network).

Home directory for the root user.

Essential system binaries (e.g., init, route, ifup).

Site-specific data which is served by the system.

Temporary files (see also /var/tmp).

Secondary hierarchy for user data; contains the majority of (multi-)user utilities and applications.

Non-essential command binaries (not needed in single user mode); for all users.

Standard include files.

Libraries for the binaries in /usr/bin/ and /usr/sbin/.

Non-essential system binaries (e.g. daemons for various network-services).

Architecture-independent (shared) data.

Source code (e.g. the kernel source code with its header files).

X Window System, Version 11 Release 6.

Tertiary hierarchy for local data, specific to this host. Typically has further subfolders, eg. bin/, lib/, share/.

Variable files, such as logs, spool files, and temporary e-mail files.

(debian-based systems) ccached files.

*.deb files downloaded when getting or updating packages from repositories, e.g. when using “sudo apt-get install”.

Lock files. Files keeping track of resources currently in use.

Log files. Various logs.

Users’ mail-boxes.

Information about the running system since last boot (e.g. currently logged-in users and running daemons).

Spool for tasks waiting to be processed (e.g. print queues and unread mail).

Deprecated location for users’ mail-boxes.

Temporary files to be preserved between reboots.

Web site files (not strictly part of the FHS but this is a very common location in the hierarchy).

Related Images: