...

/

What is the FHS?

What is the FHS?

Learn about the Filesystem Hierarchy Standard to understand what kind of files go where.

Preface

When using more than one Linux distribution, we notice that executables are almost always in /usr/bin, config files are in /etc, and so on. This is the work of the Filesystem Hierarchy Standard (FHS), which standardizes the locations of different kinds of files across Linux distributions. This has multiple advantages:

  • A program can predict where files are located. This can be very useful. For example, take a shell script that downloads an executable for us and installs it to our system. Thanks to the FHS, it can just assume that installing the executable to /usr/local/bin (the standard location for user-supplied executables) is acceptable and that it doesn’t need special cases for different Linux distributions.
  • A user can assume files are in well-known locations. This way, we don’t have to learn where specific files are all over again if we switch our Linux distribution.

Why is this relevant to packaging?

Since Alpine Linux follows version 3.0 of the FHS, we have to make sure that newly created packages also follow this specification to pass Alpine Linux’s quality assurance.

Most of the time, when we use newapkbuild to create a new APKBUILD, it will already pass all the suitable options to the respective build system to install all files in the correct directories. However, some build systems have wrong hardcoded paths or don’t properly listen to the options passed to them. Due to this, proper knowledge of the FHS ...