{"id":907,"date":"2024-12-24T11:56:15","date_gmt":"2024-12-24T11:56:15","guid":{"rendered":"https:\/\/coderepublics.com\/blog\/?p=907"},"modified":"2024-12-24T11:57:42","modified_gmt":"2024-12-24T11:57:42","slug":"linux-file-system","status":"publish","type":"post","link":"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/","title":{"rendered":"Linux Filesystem Hierarchy Standard (FHS) &#8211; Structure Overview"},"content":{"rendered":"<p>The Filesystem Hierarchy Standard (FHS) describes the directory structure and contents in Unix and Unix-like operating systems. It defines where files and directories should be located and what they should contain.<\/p>\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_71 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#Key_Features_of_FHS\" title=\"Key Features of FHS:\">Key Features of FHS:<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#Overview_of_the_Linux_File_Hierarchy_Structure\" title=\"Overview of the Linux File Hierarchy Structure\">Overview of the Linux File Hierarchy Structure<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#1_Linux_Binary_Directory\" title=\"1. Linux Binary Directory\">1. Linux Binary Directory<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#2_Configuration_Directory\" title=\"2. Configuration Directory\">2. Configuration Directory<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#3_Data_Directory\" title=\"3. Data Directory\">3. Data Directory<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#4_Linux_Memory_Directory\" title=\"4. Linux Memory Directory\">4. Linux Memory Directory<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#5_Unix_System_Resources_Directory_usr\" title=\"5. Unix System Resources Directory (\/usr)\">5. Unix System Resources Directory (\/usr)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#6_Variable_Directory_var\" title=\"6. Variable Directory (\/var)\">6. Variable Directory (\/var)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#7_Non-Standard_Directories\" title=\"7. Non-Standard Directories\">7. Non-Standard Directories<\/a><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"Key_Features_of_FHS\"><\/span>Key Features of FHS:<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<ul>\n<li><strong>Current Version<\/strong>: The current version is <strong>3.0<\/strong>, released on <strong>June 3, 2015<\/strong>, and is maintained by the <strong>Free Standards Group<\/strong>.<\/li>\n<li><strong>Philosophy<\/strong>: In Unix-like operating systems, everything is considered a file.<\/li>\n<li><strong>Adoption<\/strong>: Only Linux distributions follow the FHS, and even then, only partially. Each distribution may have its own policies, resulting in slight differences in directory tree structures across distributions.<\/li>\n<\/ul>\n<h3>Checking the FHS on Your System:<\/h3>\n<p>To find information about your system&#8217;s FHS, use the following command: <span style=\"background-color: #f2f4f5; color: #222222;\">man hier <\/span>and this command displays the directory structure specific to your system.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-913 size-full\" title=\"displays the directory structure - Man hier command in Linux\" src=\"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/displays-the-directory-structure-Man-hier-command-in-linux.png\" alt=\"displays the directory structure - Man hier command in Linux\" width=\"1198\" height=\"636\" srcset=\"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/displays-the-directory-structure-Man-hier-command-in-linux.png 1198w, https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/displays-the-directory-structure-Man-hier-command-in-linux-300x159.png 300w, https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/displays-the-directory-structure-Man-hier-command-in-linux-1024x544.png 1024w, https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/displays-the-directory-structure-Man-hier-command-in-linux-768x408.png 768w\" sizes=\"auto, (max-width: 1198px) 100vw, 1198px\" \/><\/p>\n\n<table id=\"tablepress-15\" class=\"tablepress tablepress-id-15\">\n<thead>\n<tr class=\"row-1\">\n\t<th class=\"column-1\">Directory<\/th><th class=\"column-2\">Description<\/th>\n<\/tr>\n<\/thead>\n<tbody class=\"row-striping row-hover\">\n<tr class=\"row-2\">\n\t<td class=\"column-1\">\/bin<\/td><td class=\"column-2\">Contains essential binary files and command executables that are required for system operation. These files are used by both administrators and regular users to execute commands.<\/td>\n<\/tr>\n<tr class=\"row-3\">\n\t<td class=\"column-1\">\/dev<\/td><td class=\"column-2\">Contains device-related files, such as hardware devices, RAM, and other system resources. These files allow the system to communicate with physical devices like hard drives, USBs, etc.<\/td>\n<\/tr>\n<tr class=\"row-4\">\n\t<td class=\"column-1\">\/home<\/td><td class=\"column-2\">Contains user directories where local users' personal files and configurations are stored. Each user typically has a subdirectory here.<\/td>\n<\/tr>\n<tr class=\"row-5\">\n\t<td class=\"column-1\">\/lib64<\/td><td class=\"column-2\">Holds 64-bit libraries that support 64-bit applications and programs on the operating system. These libraries are essential for running programs.<\/td>\n<\/tr>\n<tr class=\"row-6\">\n\t<td class=\"column-1\">\/mnt<\/td><td class=\"column-2\">Used to mount temporary storage devices, such as external hard drives, CD\/DVDs, or USB drives. It acts as a placeholder for mounted devices.<\/td>\n<\/tr>\n<tr class=\"row-7\">\n\t<td class=\"column-1\">\/proc<\/td><td class=\"column-2\">Contains process-related files and directories. These files provide real-time information about processes currently running on the system and are directly connected to the kernel.<\/td>\n<\/tr>\n<tr class=\"row-8\">\n\t<td class=\"column-1\">\/run<\/td><td class=\"column-2\">Holds runtime data that is needed during system operation, such as currently running processes, temporary files, and system information.<\/td>\n<\/tr>\n<tr class=\"row-9\">\n\t<td class=\"column-1\">\/srv<\/td><td class=\"column-2\">Used for service-related files. It contains data that is served by the system, such as web data, FTP servers, or other services.<\/td>\n<\/tr>\n<tr class=\"row-10\">\n\t<td class=\"column-1\">\/tmp<\/td><td class=\"column-2\">Stores temporary files. Data placed here is meant to be temporary and will be deleted automatically after a reboot or after a certain period.<\/td>\n<\/tr>\n<tr class=\"row-11\">\n\t<td class=\"column-1\">\/var<\/td><td class=\"column-2\">Contains variable data, such as log files, database files, and application data. Logs generated by system processes and applications are stored here.<\/td>\n<\/tr>\n<tr class=\"row-12\">\n\t<td class=\"column-1\">\/boot<\/td><td class=\"column-2\">Contains files required for the booting process, such as the Linux bootloader (GRUB) and the vmlinuz kernel file. If the system can't boot with the normal kernel, the rescue kernel is used.<\/td>\n<\/tr>\n<tr class=\"row-13\">\n\t<td class=\"column-1\">\/etc<\/td><td class=\"column-2\">Stores configuration and settings files for system-wide settings. Files here control everything from network configuration to software settings.<\/td>\n<\/tr>\n<tr class=\"row-14\">\n\t<td class=\"column-1\">\/lib<\/td><td class=\"column-2\">Contains 32-bit libraries necessary for running 32-bit applications on the system.<\/td>\n<\/tr>\n<tr class=\"row-15\">\n\t<td class=\"column-1\">\/media<\/td><td class=\"column-2\">Used for mounting removable media such as CD\/DVD drives, USB drives, and other external storage devices.<\/td>\n<\/tr>\n<tr class=\"row-16\">\n\t<td class=\"column-1\">\/opt<\/td><td class=\"column-2\">Typically used for installing optional or third-party software packages, especially large, self-contained applications.<\/td>\n<\/tr>\n<tr class=\"row-17\">\n\t<td class=\"column-1\">\/root<\/td><td class=\"column-2\">The home directory of the root user. It is the default directory for the system's administrator (root).<\/td>\n<\/tr>\n<tr class=\"row-18\">\n\t<td class=\"column-1\">\/sbin<\/td><td class=\"column-2\">Contains system binary files and commands that are primarily intended for use by the root user (administrator). Regular users typically don't have access to these commands.<\/td>\n<\/tr>\n<tr class=\"row-19\">\n\t<td class=\"column-1\">\/sys<\/td><td class=\"column-2\">Contains system and kernel-related files. It provides a virtual file system for interacting with the kernel and other hardware-related components. It is crucial for system management and monitoring.<\/td>\n<\/tr>\n<tr class=\"row-20\">\n\t<td class=\"column-1\">\/usr<\/td><td class=\"column-2\">Contains user programs and data, such as applications, utilities, libraries, and documentation that are not essential for the system's basic operation but are available for regular users.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n\n<h2><span class=\"ez-toc-section\" id=\"Overview_of_the_Linux_File_Hierarchy_Structure\"><\/span>Overview of the Linux File Hierarchy Structure<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The <strong>Linux File Hierarchy Structure (FHS)<\/strong> defines the organization of directories and files in Unix-like operating systems. It is maintained by the <strong>Linux Foundation<\/strong> and is fundamental to the operation of the system.<\/p>\n<p>The directories in the Linux filesystem hierarchy form the backbone of the operating system. Each directory serves a specific function within the system&#8217;s structure, ensuring seamless interaction between the operating system, applications, and users.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-933\" title=\"Linux File System Structure\" src=\"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/Linux-File-System-Structure.gif\" alt=\"Linux File System Structure\" width=\"536\" height=\"641\" \/><\/p>\n<p>In the Linux filesystem hierarchy, all directories fall under the root directory, represented by a forward slash (<strong>\/<\/strong>). It serves as the starting point for the entire file system hierarchy, encompassing everything in the system, even if files and directories are stored on different physical or virtual devices.<\/p>\n<p>Only the root user (administrator) has permission to write directly under this directory, ensuring system integrity and security.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-926 \" title=\"Linux Root Directory\" src=\"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/Linux-Root-Directory.png\" alt=\"Linux Root Directory\" width=\"764\" height=\"397\" srcset=\"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/Linux-Root-Directory.png 880w, https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/Linux-Root-Directory-300x156.png 300w, https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/Linux-Root-Directory-768x399.png 768w\" sizes=\"auto, (max-width: 764px) 100vw, 764px\" \/><\/p>\n<p>In the snapshot above, we have displayed the root directory of our Ubuntu system using the command <code>ls \/<\/code>. The forward slash (<code>\/<\/code>) represents the root directory. Directory can be less or more depending on the Linux flavour you are using.<\/p>\n<p><strong>Also Read:\u00a0<a href=\"https:\/\/coderepublics.com\/blog\/redhat\/introduction-to-linux-operating-system\/\">Introduction to Linux Operating System: A Comprehensive Guide for Beginners<\/a><\/strong><\/p>\n<h2 class=\"h1\"><span class=\"ez-toc-section\" id=\"1_Linux_Binary_Directory\"><\/span>1. Linux Binary Directory<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p><strong>Binary files<\/strong> contain compiled source code, also known as <strong>machine code<\/strong>. They are often referred to as <strong>executable files<\/strong> because they can be directly executed by the computer to perform specific tasks.<\/p>\n<h3>Key Directories for Binary Files<\/h3>\n<p>The Linux filesystem includes several directories that store binary and executable files:<\/p>\n<ul>\n<li><code>\/bin<\/code><\/li>\n<li><code>\/sbin<\/code><\/li>\n<li><code>\/lib<\/code><\/li>\n<li><code>\/opt<\/code><\/li>\n<\/ul>\n<h4><code>\/bin<\/code><\/h4>\n<p>The <code>\/bin<\/code> directory is essential for both single-user mode and multi-user environments. It contains user binaries and executable files that are commonly used by all users. Some of the key commands found in <code>\/bin<\/code> include:<\/p>\n<ul>\n<li><code>cat<\/code> \u2013 Concatenate and display files<\/li>\n<li><code>cp<\/code> \u2013 Copy files and directories<\/li>\n<li><code>cd<\/code> \u2013 Change the current directory<\/li>\n<li><code>ls<\/code> \u2013 List directory contents<\/li>\n<li><code>mv<\/code> \u2013 Move or rename files and directories<\/li>\n<li><code>rm<\/code> \u2013 Remove files or directories<\/li>\n<\/ul>\n<p><strong>Important Note:<\/strong> The <code>\/bin<\/code> directory does <strong>not<\/strong> contain any subdirectories. It is solely for executable files that are fundamental to system operations and user activities.<\/p>\n<h4><code>\/lib<\/code><\/h4>\n<p>The <code>\/lib<\/code> directory contains <strong>shared libraries<\/strong> and <strong>kernel modules<\/strong> essential for the operation of the system. These shared libraries are used by programs and commands stored in the <code>\/bin<\/code> and <code>\/sbin<\/code> directories.<\/p>\n<ul>\n<li><strong>Shared Libraries<\/strong>: These are files that provide functionality to other programs, similar to how DLL files work in Windows. Shared libraries are dynamically loaded into memory when needed.<\/li>\n<li><strong>Kernel Modules<\/strong>: These are drivers or extensions that allow the Linux kernel to interact with hardware or perform specific tasks.<\/li>\n<\/ul>\n<p>The shared library files in <code>\/lib<\/code> are easily identifiable by their names, which typically follow these patterns:<\/p>\n<ul>\n<li>Start with <code>ld*<\/code> (e.g., <code>ld-linux.so.2<\/code>)<\/li>\n<li>Start with <code>lib*<\/code> and include <code>.so.*<\/code> (e.g., <code>libfuse.so.2.8.6<\/code>)<\/li>\n<\/ul>\n<h5><code>\/lib32<\/code> and <code>\/lib64<\/code><\/h5>\n<p>During the compilation of libraries, you may come across the directories <strong><code>\/lib32<\/code><\/strong> and <strong><code>\/lib64<\/code><\/strong>, which are used to distinguish between libraries compiled for <strong>32-bit<\/strong> and <strong>64-bit<\/strong> systems. These directories clarify which register size should be used during the execution of binaries.<\/p>\n<h3><code>\/opt<\/code><\/h3>\n<p>The <code>\/opt<\/code> directory is short for <strong>optional<\/strong> and is primarily used to store <strong>optional application software packages<\/strong>. This directory is ideal for software that is not part of the default Linux installation or system package manager.<\/p>\n<p>The <code>\/opt<\/code> directory is designed to house third-party software, ensuring flexibility and organization. It is often empty unless add-on applications are explicitly installed.<\/p>\n<h2 class=\"h1\"><span class=\"ez-toc-section\" id=\"2_Configuration_Directory\"><\/span>2. Configuration Directory<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The <strong>configuration directory<\/strong> contains files that configure the parameters and initial settings for various computer programs and system operations.<\/p>\n<h3>Key Directories for Binary Files<\/h3>\n<ul>\n<li><code>\/boot<\/code><\/li>\n<li><code>\/etc<\/code><code><\/code><\/li>\n<\/ul>\n<h3><code>\/boot<\/code><\/h3>\n<p>The <code>\/boot<\/code> directory contains files required to boot the system. These files are essential for initializing a basic Linux system. Files like\u00a0Bootloader files, such as those for GRUB (Grand Unified Bootloader). Configuration files like \/boot\/grub\/grub.cfg (on older systems, it may be \/boot\/grub\/grub.conf).<\/p>\n<p><strong>Note:<\/strong> Grub Configuration Path <span style=\"background-color: #f2f4f5; color: #222222;\">\/boot\/grub\/grub.cfg<\/span><\/p>\n<h3><code>\/etc<\/code><\/h3>\n<p>The <code>\/etc<\/code> directory holds configuration files specific to your machine. It contains settings for the system and various applications. It stores <strong>static and text-based<\/strong> configuration files. Includes <strong>startup and shutdown shell scripts<\/strong> used to manage programs. Does not contain binary files.<\/p>\n<h2 class=\"h1\"><span class=\"ez-toc-section\" id=\"3_Data_Directory\"><\/span>3. Data Directory<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The <strong>data directory<\/strong> is used to store various types of system data. It includes directories for user files, server data, removable media, and temporary files.<\/p>\n<h3>Key Directories for Binary Files<\/h3>\n<ul>\n<li><code>\/home<\/code><\/li>\n<li><code>\/root<\/code><\/li>\n<li><code>\/media<\/code><\/li>\n<li><code>\/mnt<\/code><\/li>\n<li><code>\/tmp<\/code><\/li>\n<\/ul>\n<h3><code>\/home<\/code><\/h3>\n<p>It Stores users&#8217; personal files. Each user has a dedicated subdirectory within <code>\/home<\/code>, named after the username (e.g., <code>\/home\/username<\/code>). It contains subdirectories like <code>Desktop<\/code>, <code>Downloads<\/code>, <code>Documents<\/code>, <code>Pictures<\/code>, etc.<\/p>\n<p>Example: <span style=\"background-color: #f2f4f5; color: #222222;\">\/home\/john\/Downloads<\/span><\/p>\n<h3><code>\/root<\/code><\/h3>\n<p>The <code>\/srv<\/code> directory is short for <strong>service<\/strong>. It stores server-specific data for system services like:<\/p>\n<ul>\n<li><code>www<\/code> (web server data)<\/li>\n<li><code>cvs<\/code> (version control data)<\/li>\n<li><code>rsync<\/code> and <code>ftp<\/code> (file transfer services)<\/li>\n<\/ul>\n<h3><code>\/media<\/code><\/h3>\n<p>Acts as a mount point for <strong>removable media devices<\/strong>. Examples: CD-ROMs, USB drives, external hard drives, etc.<\/p>\n<h3><code>\/mnt<\/code><\/h3>\n<p>It stands for <strong>mount<\/strong>. This directory is intended for mounting temporary filesystems. It is generally kept empty by system administrators until required.<\/p>\n<h3><code>\/tmp<\/code><\/h3>\n<p>It stores temporary data, which may use disk space or RAM. Files in <code>\/tmp<\/code> are automatically deleted when the system reboots.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"4_Linux_Memory_Directory\"><\/span>4. Linux Memory Directory<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The <strong>memory directory<\/strong> contains files that provide access to system-wide information, such as devices, processes, and system-related configurations. These directories do not store actual data but act as virtual filesystems to represent system resources.<\/p>\n<h3>Key Directories for Binary Files<\/h3>\n<ul>\n<li><code>\/dev<\/code><\/li>\n<li><code>\/proc<\/code><\/li>\n<li><code>\/sys<\/code><\/li>\n<\/ul>\n<h3><code>\/dev<\/code><\/h3>\n<p>It represents device files. It contains files used to access both physical and virtual devices includes terminal devices, USB devices, and more.<\/p>\n<h3><code>\/proc<\/code><\/h3>\n<p>It contains process-related information. A pseudo-filesystem that provides information about running processes. Contains text files that represent system resources and process details.<\/p>\n<h3><code>\/sys<\/code><\/h3>\n<p>It contains system and hardware configuration files. Provides kernel information about hardware devices.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"5_Unix_System_Resources_Directory_usr\"><\/span>5. Unix System Resources Directory (<code>\/usr<\/code>)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The <strong><code>\/usr<\/code><\/strong> directory stands for <strong>Unix System Resources<\/strong> and is often pronounced as &#8220;user.&#8221; It is referred to as the <strong>secondary hierarchy<\/strong> because it contains various system resources like binaries, libraries, and documentation for user applications. This directory mainly holds shareable, read-only data.<\/p>\n<h3>Key Directories for Binary Files<\/h3>\n<ul>\n<li><code>\/usr\/bin<\/code><\/li>\n<li><code>\/usr\/include<\/code><\/li>\n<li><code>\/usr\/lib<\/code><\/li>\n<li><code>\/usr\/share<\/code><\/li>\n<li><code>usr\/local<\/code><\/li>\n<li><code>usr\/src<\/code><\/li>\n<\/ul>\n<h3><strong><code>\/usr\/bin<\/code><\/strong><\/h3>\n<p>It contains non-essential binary commands for all users. It stores executable files that are not required for the system&#8217;s basic operation but are commonly used by users.<\/p>\n<h3><strong><code>\/usr\/include<\/code><\/strong><\/h3>\n<p>It contains standard include files for the C programming language. Used by compilers during the compilation process. Stores header files that define the interfaces for system libraries.<\/p>\n<h3><strong><code>\/usr\/lib<\/code><\/strong><\/h3>\n<p>It contains libraries required by system programs. It stores shared libraries that are used by binaries in <code>\/usr\/bin<\/code> and <code>\/usr\/sbin<\/code>.<\/p>\n<h3><strong><code>\/usr\/share<\/code><\/strong><\/h3>\n<p>It stores architecture-independent data. Contains files that are not dependent on the hardware architecture of the system.<\/p>\n<h3><strong><code>\/usr\/local<\/code><\/strong><\/h3>\n<p>It is used for locally installed software. Software installed from source or third-party applications is typically installed here.<\/p>\n<h3><strong><code>\/usr\/src<\/code><\/strong><\/h3>\n<p>It stores source code. This directory holds the source code for software and system components, including the kernel source code and its associated header files.<\/p>\n<h2 class=\"h1\"><span class=\"ez-toc-section\" id=\"6_Variable_Directory_var\"><\/span>6. Variable Directory (\/var)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The <strong><code>\/var<\/code><\/strong> directory is short for <strong>variable<\/strong>. It stores files that have an unpredictable size and are expected to change continuously during the normal operation of the system. These files include log files, spool files, and cache files, hence the name &#8220;variable.&#8221;<\/p>\n<h3>Key Directories for Binary Files<\/h3>\n<ul>\n<li><code>\/var\/log<\/code><\/li>\n<li><code>\/var\/cache<\/code><\/li>\n<li><code>\/var\/spool<\/code><\/li>\n<li><code>\/var\/lib<\/code><\/li>\n<\/ul>\n<h3><strong><code>\/var\/log<\/code><\/strong><\/h3>\n<p>It stores system and application log files that record system events, application errors, and other important system information.<\/p>\n<h3><strong><code>\/var\/cache<\/code><\/strong><\/h3>\n<p>It stores cache data generated by applications. Cache files can be safely deleted without losing important data, as they can be regenerated when needed.<\/p>\n<h3><strong><code>\/var\/spool<\/code><\/strong><\/h3>\n<p>It stores files that are waiting to be processed. It contains data for tasks that are queued for processing, such as print jobs, mail queues, and cron jobs.<\/p>\n<h3><strong><code>\/var\/lib<\/code><\/strong><\/h3>\n<p>It stores state information and data files. It contains files that store system and application state information, such as databases or metadata. The files in this directory are frequently modified as the corresponding programs run and update their state.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"7_Non-Standard_Directories\"><\/span>7. Non-Standard Directories<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Non-standard directories are those that do not fall under the standard <strong>Filesystem Hierarchy Standard (FHS)<\/strong>. These directories are typically specific to certain Linux distributions or applications.<\/p>\n<h3>Key Directories for Binary Files<\/h3>\n<ul>\n<li><code>\/cdrom<\/code><\/li>\n<li><code>\/run<\/code><\/li>\n<li><code>\/lost+found<\/code><code><\/code><\/li>\n<\/ul>\n<h3><strong><code>\/cdrom<\/code><\/strong><\/h3>\n<p>It is used for mounting CD-ROM devices. According to the FHS, CD-ROMs should ideally be mounted under \/media instead.<\/p>\n<h3><strong><code>\/run<\/code><\/strong><\/h3>\n<p>It stores runtime variable data. The \/run directory contains data about the system since the last boot. It holds information about running processes, daemons, and other runtime information. This directory is typically cleared when the system reboots.<\/p>\n<h4><strong><code>\/lost+found<\/code><\/strong><\/h4>\n<p>It stores recovered files after a filesystem check. After a system crash or during a filesystem check (using <code>fsck<\/code>), lost data that is recovered may be placed in this directory. The recovered data may not always be in usable form and could be fragmented.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The Filesystem Hierarchy Standard (FHS) describes the directory structure and contents in Unix and Unix-like operating systems. It defines where files and directories should be located and what they should contain. Key Features of FHS: Current Version: The current version is 3.0, released on June 3, 2015, and is maintained by the Free Standards Group. &#8230; <a title=\"Linux Filesystem Hierarchy Standard (FHS) &#8211; Structure Overview\" class=\"read-more\" href=\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/\" aria-label=\"More on Linux Filesystem Hierarchy Standard (FHS) &#8211; Structure Overview\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":940,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,72],"tags":[82],"class_list":["post-907","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","category-redhat","tag-linux-file-system"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux Filesystem Hierarchy Standard (FHS) - Structure Overview - CodeRepublics<\/title>\n<meta name=\"description\" content=\"Explore the Linux File System Hierarchy (FHS) and learn essential directories like \/bin, \/etc, \/home, and more. Understand their functions &amp;\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux Filesystem Hierarchy Standard (FHS) - Structure Overview - CodeRepublics\" \/>\n<meta property=\"og:description\" content=\"Explore the Linux File System Hierarchy (FHS) and learn essential directories like \/bin, \/etc, \/home, and more. Understand their functions &amp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/\" \/>\n<meta property=\"og:site_name\" content=\"CodeRepublics\" \/>\n<meta property=\"article:published_time\" content=\"2024-12-24T11:56:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-12-24T11:57:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/Linux-File-System.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"647\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"coderepublics\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"coderepublics\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/\"},\"author\":{\"name\":\"coderepublics\",\"@id\":\"https:\/\/coderepublics.com\/blog\/#\/schema\/person\/6cb111394a135c39b6b46f612f218063\"},\"headline\":\"Linux Filesystem Hierarchy Standard (FHS) &#8211; Structure Overview\",\"datePublished\":\"2024-12-24T11:56:15+00:00\",\"dateModified\":\"2024-12-24T11:57:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/\"},\"wordCount\":1493,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/coderepublics.com\/blog\/#\/schema\/person\/6cb111394a135c39b6b46f612f218063\"},\"image\":{\"@id\":\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/Linux-File-System.jpg\",\"keywords\":[\"Linux file system\"],\"articleSection\":[\"Blog\",\"RedHat\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/\",\"url\":\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/\",\"name\":\"Linux Filesystem Hierarchy Standard (FHS) - Structure Overview - CodeRepublics\",\"isPartOf\":{\"@id\":\"https:\/\/coderepublics.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/Linux-File-System.jpg\",\"datePublished\":\"2024-12-24T11:56:15+00:00\",\"dateModified\":\"2024-12-24T11:57:42+00:00\",\"description\":\"Explore the Linux File System Hierarchy (FHS) and learn essential directories like \/bin, \/etc, \/home, and more. Understand their functions &\",\"breadcrumb\":{\"@id\":\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#primaryimage\",\"url\":\"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/Linux-File-System.jpg\",\"contentUrl\":\"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/Linux-File-System.jpg\",\"width\":1000,\"height\":647,\"caption\":\"Linux File System\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/coderepublics.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux Filesystem Hierarchy Standard (FHS) &#8211; Structure Overview\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/coderepublics.com\/blog\/#website\",\"url\":\"https:\/\/coderepublics.com\/blog\/\",\"name\":\"CodeRepublics\",\"description\":\"Web Technology\",\"publisher\":{\"@id\":\"https:\/\/coderepublics.com\/blog\/#\/schema\/person\/6cb111394a135c39b6b46f612f218063\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/coderepublics.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/coderepublics.com\/blog\/#\/schema\/person\/6cb111394a135c39b6b46f612f218063\",\"name\":\"coderepublics\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/coderepublics.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2023\/08\/Coderepublics.jpg\",\"contentUrl\":\"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2023\/08\/Coderepublics.jpg\",\"width\":1500,\"height\":784,\"caption\":\"coderepublics\"},\"logo\":{\"@id\":\"https:\/\/coderepublics.com\/blog\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/coderepublics.com\/blog\"],\"url\":\"https:\/\/coderepublics.com\/blog\/author\/coderepublics\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux Filesystem Hierarchy Standard (FHS) - Structure Overview - CodeRepublics","description":"Explore the Linux File System Hierarchy (FHS) and learn essential directories like \/bin, \/etc, \/home, and more. Understand their functions &","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/","og_locale":"en_US","og_type":"article","og_title":"Linux Filesystem Hierarchy Standard (FHS) - Structure Overview - CodeRepublics","og_description":"Explore the Linux File System Hierarchy (FHS) and learn essential directories like \/bin, \/etc, \/home, and more. Understand their functions &","og_url":"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/","og_site_name":"CodeRepublics","article_published_time":"2024-12-24T11:56:15+00:00","article_modified_time":"2024-12-24T11:57:42+00:00","og_image":[{"width":1000,"height":647,"url":"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/Linux-File-System.jpg","type":"image\/jpeg"}],"author":"coderepublics","twitter_card":"summary_large_image","twitter_misc":{"Written by":"coderepublics","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#article","isPartOf":{"@id":"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/"},"author":{"name":"coderepublics","@id":"https:\/\/coderepublics.com\/blog\/#\/schema\/person\/6cb111394a135c39b6b46f612f218063"},"headline":"Linux Filesystem Hierarchy Standard (FHS) &#8211; Structure Overview","datePublished":"2024-12-24T11:56:15+00:00","dateModified":"2024-12-24T11:57:42+00:00","mainEntityOfPage":{"@id":"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/"},"wordCount":1493,"commentCount":0,"publisher":{"@id":"https:\/\/coderepublics.com\/blog\/#\/schema\/person\/6cb111394a135c39b6b46f612f218063"},"image":{"@id":"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#primaryimage"},"thumbnailUrl":"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/Linux-File-System.jpg","keywords":["Linux file system"],"articleSection":["Blog","RedHat"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/","url":"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/","name":"Linux Filesystem Hierarchy Standard (FHS) - Structure Overview - CodeRepublics","isPartOf":{"@id":"https:\/\/coderepublics.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#primaryimage"},"image":{"@id":"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#primaryimage"},"thumbnailUrl":"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/Linux-File-System.jpg","datePublished":"2024-12-24T11:56:15+00:00","dateModified":"2024-12-24T11:57:42+00:00","description":"Explore the Linux File System Hierarchy (FHS) and learn essential directories like \/bin, \/etc, \/home, and more. Understand their functions &","breadcrumb":{"@id":"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#primaryimage","url":"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/Linux-File-System.jpg","contentUrl":"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2024\/12\/Linux-File-System.jpg","width":1000,"height":647,"caption":"Linux File System"},{"@type":"BreadcrumbList","@id":"https:\/\/coderepublics.com\/blog\/redhat\/linux-file-system\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/coderepublics.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Linux Filesystem Hierarchy Standard (FHS) &#8211; Structure Overview"}]},{"@type":"WebSite","@id":"https:\/\/coderepublics.com\/blog\/#website","url":"https:\/\/coderepublics.com\/blog\/","name":"CodeRepublics","description":"Web Technology","publisher":{"@id":"https:\/\/coderepublics.com\/blog\/#\/schema\/person\/6cb111394a135c39b6b46f612f218063"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/coderepublics.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/coderepublics.com\/blog\/#\/schema\/person\/6cb111394a135c39b6b46f612f218063","name":"coderepublics","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/coderepublics.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2023\/08\/Coderepublics.jpg","contentUrl":"https:\/\/coderepublics.com\/blog\/wp-content\/uploads\/2023\/08\/Coderepublics.jpg","width":1500,"height":784,"caption":"coderepublics"},"logo":{"@id":"https:\/\/coderepublics.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/coderepublics.com\/blog"],"url":"https:\/\/coderepublics.com\/blog\/author\/coderepublics\/"}]}},"_links":{"self":[{"href":"https:\/\/coderepublics.com\/blog\/wp-json\/wp\/v2\/posts\/907","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/coderepublics.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/coderepublics.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/coderepublics.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/coderepublics.com\/blog\/wp-json\/wp\/v2\/comments?post=907"}],"version-history":[{"count":14,"href":"https:\/\/coderepublics.com\/blog\/wp-json\/wp\/v2\/posts\/907\/revisions"}],"predecessor-version":[{"id":943,"href":"https:\/\/coderepublics.com\/blog\/wp-json\/wp\/v2\/posts\/907\/revisions\/943"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/coderepublics.com\/blog\/wp-json\/wp\/v2\/media\/940"}],"wp:attachment":[{"href":"https:\/\/coderepublics.com\/blog\/wp-json\/wp\/v2\/media?parent=907"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/coderepublics.com\/blog\/wp-json\/wp\/v2\/categories?post=907"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/coderepublics.com\/blog\/wp-json\/wp\/v2\/tags?post=907"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}