The Linux directory structure is a tool that allows users to work comfortably. This is due to the standards that specify the location of files and the elements found in them.
If you want to know what the Linux directory structure is for and how the FHS works, you will need to read this article to the end. You will find all the information related to the hierarchy of the files.
By last, you will see a list with the main Linux directories and you will know the elements that are in each one of them. Let us begin.
What is the Linux directory structure and what is it for?
A SW functional depends on thousands of files. These can be executable, text and configuration among others, which have a logical order in storage so that it is possible to run the operating system successfully. To that end Linux establishes a predefined order or structure for its files and directories.
This system is organized hierarchically and begins with a root directory or root symbolized by a /. From this base or origin all the subdirectories, files or archives that are inside the OS start. Its architecture is comparable to that of a tree, which has a taproot that supports everything and gradually branches off. This is how most Linux-based distro works that show, roughly, that all data is seen as a file.
It does not matter if they are pen drives, configurations, binaries or images, they all have an exact order for each file. It must be added that there are subdirectories or “Branches” basic for the optimal functioning of the OS, so from there each folder or node can have more directories or internal files. This establishes the path, path or Path that must be traveled to reach a specific file.
In Linux everything is a file. How does the operating system’s FHS work?
To sustain this hierarchy between so many distributions Linux, the FHS (acronym for Filesystem Hierarchy Standard or file system hierarchy standard) which is nothing more than a series of parameters that manufacturers consult. These help to define in general terms where it will be, what each item will contain, how they will be named, and who will use each directory. This way you can set the standards for certain roles for permissions, locations, content, and more.
In this way the files and directories can present a homogeneous appearance between the multiple versions. Keep in mind that FHS parameters allow certain freedoms, which give way to the various typical characteristics between each of the Linux distro. Among the guidelines, depending on the functionality of the directories, there are shareable and non-shareable. The former, as their name indicates, facilitate access to files from various computers.
While the seconds are reserved for the user with root permissions (also called superuser). In the same way, there are variable directories that allow the modification of files to any user. For example, /home or certain files within / var they are a clear example of the use that can be given to them. There are also the static, which refer to any directory that can only be altered with the authorization of the administrator. In this list you can find / bin, / etc / passwd Y / opt, among others.
List of the main Linux directories and what we can find in them
We will show you below the most complete list with the Linux main directories.
In it you will be able to find all the information you need to become an expert:
If you need to find photographs, videos, text documents or other personal files of the users, you will have to make use of /home. This is the starting point or working directory for the storage of all logged in users. Such a folder can have hundreds of subdirectories stored in an orderly fashion. Within this you will also be able find necessary settings for programs used by users that can be saved to a separate extra partition.
Being Linux a multi-user system / root is he working directory of the administrator of the entire OS. This is used to mark the hierarchy between users and determine who has access to privileged permissions, also known as user root or Super user.
Under the directory / bin they keep all the binary files of commands that the operating system requires to work. Unlike others, this one does not contain subdirectories, depending on the FHS it is a static directory. It should be borne in mind that in this type of directory, the elements found within it can be shared, although the changes could generate instabilities in the OS.
In the folder / bin you will be able to find all libraries or shared libraries, which are required to start executable files. In turn, these are stored in other directories such as / sbin Y / bin. In addition, this folder includes kernel modules, essential for booting the OS and driver drivers, since it is the core of Linux.
If you go to / usr you will be able to access secondary user data including multi-user applications. These files are readable, so you will not find problems when viewing them, if you have standard user permissions. Some of the subdivisions of directories that you will be able to use are / usr / local, / usr / bin Y / usr / lib, among other.
With /half it happens the same as with / mnt for users with standard permission, this is because you can Compile removable device mount points. You will also be able to mount USB memories, SD cards or Memory Stick for its execution.
In / opt you will have third-party program files. That is, you will be able to find the files that do not come by default in the OS and that, in general, are installed by the user for certain tasks. From this it follows that / opt they do not have the configuration options included in the same directory.
Contains the files referring to system processes at specific times. Its use is important to access restore points to run analysis of the behavior of certain elements.
This directory is used for save server data that you have connected to the equipment.
It is a directory that acts similar to / bin already / sbin, since it also saves executable binary files. You must bear in mind that in this directory you will only find essential binaries for restoring, repairing or booting the system. So that you can only run a superuser.
In / sys there are the folders that provide system data. For example, partitions, drives, and the kernel.
If you go to the directory /etc being an administrator, you will find the OS configuration files. This means that you will be able to work with the files of the program configuration and also the programming language.
This is a very important directory in Linux why stores the files that the operating system requires for startup. It is normal that it contains the kernel and Grub files (a bootloader). For this reason, it is not shareable and only a root user accesses it.
With / dev you will have the files that belong to the devices connected to your computer, it can be from the keyboard to an external hard drive. All of these hardware or virtual elements are treated by the system as files to simplify the flow of information.
Diminutive of temporary. / tmp compiles the temporary files that programs require for its execution, an automatic or manual emptying of this folder is usually performed.
For his part / var stores temporary or variable data information in order to alert and eradicate detected problems. In some cases it is placed on its own partition, outside the root directory.
What are the benefits of using this file system?
While it is true that a creator of a distro of Linux can decide whether or not to adhere to the parameters FHS, it is convenient to know that there are considerable advantages to considering this structure. This is because will create a friendlier environment for any user or programmer you are already familiar with Linux. It will also make it possible for the user to easily find any file they need to perform a specific task, be it mounting a removable device or managing groups or users.
It will even favor the performance of the developers, the maintenance of the OS and the repair of errors found in the programming. But this is not all, I also know contributes to the better functioning of the programs. In addition, the creator will not be forced to devise a new hierarchy for his files, if he follows the FHS.
In short, if a programmer is based on the structuring of files, he will have a simple, understandable and coherent system in all aspects. Inclusive it is easier to determine the permissions granted to users for the execution or reading of files. In this way, it also strengthens the security of the information handled by the operating system.
If you have any questions, leave them in the comments, we will answer you as soon as possible, and it will also be of great help to more members of the community. Thank you! 😉