This topic was published by DevynCJohnson and viewed 1680 times since "". The last page revision was "".
- Topics - 443
The File Hierarchy Standard (FHS) is a standard used by many (if not all) GNU/Linux systems and many other Unixoid systems (Unix and Unix-like systems). The FHS is so important and helpful that the FHS is included in the Linux Standard Base (LSB). The FHS is an important standard which allows people to find the same file on any given Linux system. Also, it ensures GNU/Linux programs work on all distros. The standard allows distros to have their own policy in areas that are not specified by the FHS. So, some people may notice some differences in the directory tree among distros, especially when viewing older distros that used older FHS standards. The standard discussed in this article is the latest at the time of writing this article - FHSv2.3.
All files, folders, and storage devices are under root, which is designated as "/". Many folders will be seen under root. Some are standard and others are not.
/bin/ - BINaries are stored in here, but not just any binary file. When in single-user mode, these are the only commands and programs a user may use. If there is a binary you with to use while in single-user mode, then place it in here. This folder does not contain directories.
/boot/ - All files associated with the bootloader and booting are in here. This is where GRUB, Syslinux, and other bootloaders store their files.
/dev/ - DEVice files are kept in here. Remember that in GNU/Linux, everything is a file including devices, directories, network sockets, pipes, etc. The files used to represent and access devices are stored in here. However, not all of the files are associated with real devices. Some are virtual devices such as /dev/null and /dev/random.
/etc/ - System-wide configuration files are kept in here. The meaning of the "etc" is now debated. The most likely meaning is "Editable Text Configuration". The configuration files for programs installed in /opt/ are kept in /etc/opt/. The X Window System has its configuration files stored in /etc/X11/.
/home/ - The home folders for users are kept in here. Inside of /home/ is a folder for each user, and the directories are named after their owners/users. Inside of a user's home folder, you may find a folder for downloads (/home/USER/Downloads/), pictures (~/Pictures/), and other folders and files. Users can store their personal files and configuration files in their home folder. The only person that can access the user's home folder and files is the user his/herself and the Root user. All users can access any user's public folder (~/Public/). Linux systems use the tilde (~) as a shortcut which means the logged in user's home. For illustration, if Bill is logged in, then the value of the tilde is /home/bill/. So, /home/bill/Downloads/ is the same as ~/Downloads/.
/lib/ - Library files are kept in here. The Linux kernel modules are kept under /lib/modules/ and firmware drivers are under /lib/firmware/.
/lib*/ - Other library directories may exist under root. For instance, /lib64/ contains 64-bit-specific libraries.
/lost+found/ - If a disk check (like fsck) finds and recovers a damaged file, then the file can be placed there for the user to retrieve. The file may or may not be complete or in good condition.
/media/ - This directory is commonly used to mount storage units. Some distros may have a directory for each user and then their mount storage inside. For instance, if Bill mounts a partition named "SCRIPTS", then to access his files on SCRIPTS, he would go to /media/bill/SCRIPTS/.
/mnt/ - Some systems may mount storage under /mnt/.
/opt/ - OPTional software is installed under /opt/. Some games (like Desurium) go here as well as proprietary software and some third party applications.
NOTE: Games have no set standard for placement. Some may go under /opt/ (like Desurium), some in /usr/bin/ (like ZSNES), /usr/local/games/ or /usr/games/ (like 0AD). Often times, the sounds files and other data are stored in /usr/share/games/.
/proc/ - The ProcFS is mounted here.
/root/ - Users have their home file under /home/, right? Well, then where are Root's files? The Root user's home is /root/. Obviously, only Root has access to this folder. However, the Root's public folder is shared.
NOTE: The Root user has nothing to do with the root of the directory tree. "/" is the top (or bottom) of the file hierarchy, /root/ is a folder, and the Root user is the super-admin. There can only be one Root, which has more (all) privileges than admins. By the way, you can have all the admins you want, but only one Root.
/sbin/ - Like /bin/, these binaries can be used in single-user mode (or any other mode). However, only Root can execute these, or other users must have special privileges (via sudo, su, or something else). These are the System BINaries. Examples include /sbin/e2fsck, /sbin/swapon, /sbin/wipefs, /sbin/route, and others.
NOTE: When in single-user mode, the only usable binaries are in /bin/ and /sbin/ (with Root privileges).
/srv/ - Various services may store files in this directory. Many distros use /var/ instead. Although, according to the FHS standards, services should use /srv/ instead.
/tmp/ - Many temporary files are stored here. The tmpfs virtual filesystem mounts here.
/usr/ - The USeR directory is often called the Secondary-Hierarchy due to the fact it contains many directories that follow the FHS standard. /usr/bin/ contains binaries like /bin/, but these cannot be accessed in single-user mode. For example, Firefox is stored in /usr/bin/ because it is a binary that is to be used by all users and it cannot be used (nor is it needed) in single-user mode. Only the necessary commands/programs for single-user mode are stored in /bin/. Header files are stored in /usr/include/. /usr/lib/ and similar directories (like /usr/lib32/) may store libraries for the binaries in /usr/bin/ and /usr/sbin/. However, on some systems, /usr/lib*/ may be a shortcut/link to /lib/. System binaries of less importance are stored in /usr/sbin/ such as arp, cupsd, logrotate, and others. /usr/share/ contains files needed by some binaries, binaries themselves, and other system-specific software/data. For instance, the different icon themes are stored under /usr/share/icons/. Source code is kept under /usr/src/.
NOTE: The Primary-Hierarchy is root (/).
/usr/local/ - This is the Tertiary-Hierarchy.
/var/ - VARiable files are stored here. This means files whose contents change often (such as logs) are stored here. /var/cache/ stores cache. Crash dumps are stored in /var/crash/. /var/lib/ contains databases or other special files that programs often change. /var/logs/ is a very popular directory since it contains the system logs. /var/mail/ contains the users' mailboxes (if enabled). /var/run/ keeps information about the last system boot. On some systems, this may be a shortcut/link to /run/. The system's spool is in /var/spool/. Temporary files that are needed after a reboot (or longer) are stored in /var/tmp/. If the system is an NIS server, than users may see /var/yp/ which stores NIS database files.
/cdrom/ - This is used as a mount-point for optical disks on some systems.
/config/ - A mount-point for configfs.
/mount/ - This is the same as /mnt/. Usually, distros use /mnt/.
/run/ - This is a directory that contains writable files that were once in /etc/, /var/run/ and /var/lock/, /dev/shmem/, and some other directories and data.
/selinux/ - SElinux stores its files in here.
/sys/ - The pseudo filesystem, sysfs, mounts here.
FUN FACT: GoboLinux does not follow the FHS standard. GoboLinux has its own policy - /Programs/, /Users/, /System/, /Files/, /Mount/, and /Depot/.
Some directories can be shared with many Linux distros without issues while some directories are system specific. /usr/, /opt/, /var/mail/, and /var/spool/news/ can be shared among different Linux distros without any issues. Just make sure when a computer uses an executable from another that the CPU is compatible with the binary that will be executed. However, some directories should not be shared because the data is specific to that system. /boot/ and /etc/ are two examples of such directories.
By the way, if you like my icons that I have in the screenshots, then you may want to check out Noobslab's icons and themes.