What is Filesystem Hierarchy Standard?

Filesystem Hierarchy Standard (FHS) – are set of rules that defines the main categories and their contents in the Linux Operating System. It is maintained by the Linux Foundation, a non-profit organization. This standard also helps softwares predict the location of installed files and directories, or for users to be able to find them.

The most distinctive features of FHS – compliant system is as follows;

The short definition of each are as follows;

It has the / (called “root) as the primary directory of the entire filesystem hierarchy. /bin contains essential binaries, that needs to be available in single user mode; for all users, e.g., cat, ls, grep. /boot has boot loader files, e.g., kernels, initrd; it is sometimes kept on a separate partition. /dev contains essential device files, like /dev/null which is like a black hole that we can transfer our output from the terminal if we don’t want to see theme. /etc contains host–specific system – wide configuration files. /home is the users home directory, containing saved files, personal settings, etc., it can be put in its own partition. /lib is libraries essential for binaries in /bin and /sbin. /media is the mount points for removable devices such as pendrives. /mnt shows the temporary mounted filesystems. /opt is where optional application software packages are kept. /proc is a virtual filesystem which documents kernel and process status as text files. e.g. cat /proc/cpuinfo will give you your cpu information, or some commands such as uptime, which tells you how long your pc has been running, comes from /proc. /root is the home directory of the root user. Please do note that this /root and / (called “root”) is not to be confused. /root has the administrator user privileges.

The full definitive of each are as follows;

/bin – contains commands that are used both by an administrator and the user. It is present even if no other filesystem is present, e.g., single user. It also contains commands which are used indirectly by scripts. It should no sub – directories. The real commands or symbolic links to commands are required. Some of the commands include; “cat, chmod, mv, cp, date” One more thing to note is that if /bin/sh was not the real command to the Bourne Again Shell, it should either be a hardlink or a symbolic link to the real one.

/boot – static files of the boot headers, containing files to boot but does not include configuration files not needed at boot time. It also stores data used before the kernel executes user – mode programs. It includes sub – directories to the grub configuration and installed kernel configuration files. The kernel must be at either / or /boot.

/dev – is a location for special or device files. The majority are either block or character devices, other types can exist and be created. “Block devices” refers to devices that can store data or hold data, “Character devices” refers to devices that transmit or transfer data. e.g. of /dev files; /dev/sda, /dev/usb. CD-ROM = block devices, serial ports = character devices.

/etc – can be considered as the nervous system of the system. It contains all configuration files or in sub directories. “configuration files” are locale files used to control the operation of a program. The configuration files must be static and should not be executable binaries. There should be directories or symbolic links of opt, X11, sgml and xml are required.

  • /etc/X11 – configuration files for the X Window System. It is a symbolic link from /usr/X11R6
  • /etc/x11/gdm – GNOME Display Manager configuration files are kept here. It provides an equivalent of a login prompt , X display, pops up a login window and starts X session, greeting windows. It is written in GNOME libraries therefore look like GNOME applications.
  • /etc/apt – Debian’s next generation dpkg manager. Provides apt-get utility, which in turn provides simple, safe way to install/remove packages.
  • /etc/apt/sources.list – contains a list of apt-sources from which packages may be install via Advanced Packaging Tool (APT).
  • /etc/fstab – configuration files for “mount” and “supermount”. This configuration file decides which filesystems to be mounted automatically at startup.

/home – as Linux is multi-user system, each user has their own separate directory. Available only to them and the administrator. Each users’ home directory can be found at /home/username. The personal configuration files for each user is stored there, and the file names are preceded by (dot) in front.

/lib – contains kernel modules and share libraries, such as ( C programming code library ), needed to boot the system and run the commands in the root filesystem, such as /bin and /sbin/. The shared files can be seen with *.so extension, they can be considered/equivalent as/to .DLL in windows.

/media – directory for mount points for removable media.

/opt – is reserved for all softwares and add-on packages that are not part of the default installation.

/proc – a virtual filesystem, also refered to as process information pseudo-file system. It doesn’t contain “real” files but runtime system informations, such as, system memory, devices mounted, hardware configurations. System utilities such as lsmod and lspci are shortcut commands equal to cat /proc/modules and cat /proc/pci.

/root – home directory for the system administrator “root”.

/sbin – as Linux differentiates between “normal” and system maintenance/admin task executables, /sbin is used to keep the latter.

File System Standard (FSSTND) states – /sbin should contain only binaries essential for booting, restoring, recovering, and/or repairing the system in addition to the binaries in /bin.

/usr – has the largest share of data on the system. It is the most important directory in the system; binaries, docs, libraries, header files, programs, telnet, ftp. /usr is shareable, read-only but can be shared among FHS-compliant hosts but must not be written in.

  • /usr/bin – vast majority of binaries, executables are in this directory. e.g. vi, gcc, gnome-session and mozilla.
  • /usr/lib – program libraries. Libraries are collectors of frequently used programs routines.
  • /usr/src/linux – source code for kernel.

/var – variable files, files whose content is expected to continually change during normal operations of the system, such as, logs, spool files and temporary email files. It is sometimes kept on a separate partition. Some files are not shareable between systems, such as, /var/log, /var/lock and /var/run.

  • /var/log – log files from the system and various programs/services.
  • /var/opt – variables data of the program packages in /opt/ must be installed in /var/opt/<package-name>
  • /var/run – the process identification files (PIDs) of system services and information about the system are valid till system is restarted/booted.

To agree with the FSSTND, these directories or symbolic links in /var are needed;

    • /var/cache – application cache data
    • /var/lib – variable state information
    • /var/local – variable data for /usr/local
    • /var/lock – lock files
    • /var/opt – variable data for /opt
    • /var/run – data relevant to running processes.
    • /var/spool – application spool data
    • /var/tmp – temporary files preserved between system boots.

/srv – site-specific data which is served by the system.

/tmp – temporary files often not preserved between system boots.

About Mohi

I am a Free software Advocate and Ubuntu lover. My Wiki: https://wiki.ubuntu.com/Mohan_chml

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>