Simple explanation of the GNU / Linux directory tree

Linux main directory tree

Said the great Dennis Ritchie than "UNIX is very simple, it only takes a genius to understand its simplicity«. And really, although it may seem very complex in some things, * nix, and therefore Linux, are quite simple in others. In fact, it is in this simplicity that makes them so good, flexible and attractive. Well, in this article, we are going to explain the GNU / Linux directory tree in a very simple way.

Thus, the directories or folders of your distro they will have no secrets for you. Special dedication to those who are new and who come from Microsoft Windows, since if they come from other UNIX they will adapt almost immediately due to the similarity. But it is true that in Windows you may know where the C: drive is, where Documents or Downloads are, where the Desktop or perhaps where the programs are installed, but for simplicity you don't need to know much more.

Instead, in the * nix, yes you should know directory tree in a deeper way, since they will help us to find configuration files, install certain packages in the right place, locate the kernel sources, or its image, our personal files, etc .:

  • /: is the main river, the root or root. The rest of the directories hang from it, that is, all the others will be subdirectories of it (even if they are on different partitions or disks). It is undoubtedly the most important.
  • / bin: is the directory where the binaries are stored, that is, the programs used by the system for administrative tasks such as the commands cp, echo, grep, mv, rm, ls, kill, ps, su, tar, etc.
  • / sbin: S is for System, and as its name indicates, the binaries or programs used by the operating system itself are stored here for startup tasks, restoration, etc. For example, fsck, mount, mkfs, reboot, swapon, ...
  • / Boot: is the boot directory, where the Linux kernel image (s) that will be loaded during boot are located, as well as directories and configuration of the boot loader itself.
  • / Dev: it is a very special directory where block or character devices are found, that is, files that represent memory, partitions, disks, hardware devices, etc. You already know that in UNIX "everything" is a file, and not drives like in Windows ... For example, the hard disk or partitions will be / dev / sda1, / dev / sda2, ... / dev / sdb1, etc.
  • / mean or / mnt: are the directories where mount points are generally set. That is, when we insert some removable media or shared network resource, etc., that we have mounted, it would be here if we have put it as a mount point. The first is more specific for media that is mounted on a temporary basis.
  • / Etc: very important for the administrator, since the configuration files of the system components and other installed programs reside here.
  • / Home: is the directory for standard users. For example, here the personal files are stored in separate directories (one for each user with their name). For example, / home / isaac or ~ would be my home directory ...
  • / lib or / lib64: is where the libraries necessary for the binaries present in the system are housed. In / lib64 will be those of the 64-bit applications.
  • / Opt: is a directory that will store the packages or programs installed on the system that are from third parties. For example, if we install an antivirus, Chrome, Arduino IDE, ... or certain large packages, they are usually installed here.
  • / Proc: it is another very special directory, more than a directory it is an interface to put it simply. And here the system presents the processes as directories numbered with the PID. Within each one of them will be all the information necessary for the execution of each ongoing process. In addition, you will find files from which to extract important information, such as cpuinfo, meminfo, etc. It is precisely from these files that some commands that we usually use extract information, such as, for example, when we use free to consult the available memory, this command will actually be showing the content of / proc / meminfo in an orderly way.
  • / Root: not to be confused with /, one thing is the root directory or root and quite another / root. In this case, it can be similar to a / home but exclusive to the root or privileged user.
  • / svr: stores files and directories related to servers that you have installed in the system, such as web, FTP, CVS, etc.
  • / sys: along with / dev and / proc, is another of the specials. And since / proc, it doesn't really store anything, but rather is an interface as well. In this case, they are virtual files with kernel information and some of their files can even be used to configure certain kernel parameters.
  • / Tmp: is the directory for temporary files of all kinds. It is used by users to temporarily store certain files or even to store cache or certain volatile files from web browsers, etc. However, there is another directory for the same in / var / tmp.
  • / var: since I have named it before, it is a directory with directories and files that tend to grow in size, such as databases, logs, etc. It is precisely the logs or system registers that make this directory more popular, and there you will find a lot of information about everything that happens in the system: / var / logs /. Within this directory you will find, separated by directories, the logs of a multitude of software, including the system.
  • / Usr: is the acronym for User System Resources, and currently stores read-only files relative to user utilities, such as the packages that we install through the package manager in our distro. Inside there is a "replica" of the directory tree seen so far (almost all of them) as if it were a second level. You will find / usr / bin, / usr / lib, / usr / sbin, / usr / src, etc., which from what was said above and their names, you can get an idea of ​​what they store. Just say that / usr / src is where the source code files will stay.

Keep in mind that not all distros follow this scheme and there may be slight variations, but if they are adapted to the FHS, you won't have too much problem ...


Leave a Comment

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

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   hiccup said

    "Store read-only files relative to user utilities"

    Wonderful.

  2.   L said

    ti never has an accent (second paragraph)