How does the Linux file structure work?
In this post, you will learn how the Linux file structure works and also the most important directories and their functions.

Linux file structure
The first question we have to answer is about the term directory.
Directory in Linux is the same thing as a folder in Windows.
That said, which is a question of many, we can now move on to the file/directory structure.
That is nothing but a set of directories that are common in many Linux distributions, of course, some have a few more directories.
In this post, we will cover all that is in the Ubuntu distribution, since it is the most used.
Directory /
The / directory is the system root, from there we will see the other Linux directories.
There is no one else before him, only after.
/bin directory
In the bin directory, we will have system executable files.
Some contents of the bin are: shell, ls, tar, kill, grep, echo, cp, rm and mv.
shell would be an application that runs the commands we type in the terminal.
The others are widely used commands, anyone who has used Linux knows. 😀
/boot directory
In the boot directory, we will have files that make the system initialization.
/dev directory
In this directory, we will have files for all input and output devices on the system.
We don’t have drivers like Windows on Linux, we have files that represent all these devices connected to the computer.
/etc directory
In the /etc directory we will find system configuration files.
For example, Apache configuration, which is a web server.
/home directory
In the /home directory we will have the directories of each user on the system.
For example:
- /home/matheus
- /home/mary
- /home/rodrigo
So each directory of this contains the unique files of each user.
/lib directory
Contains library files that are shared across applications.
And also files needed to boot the system.
/media directory
The /media directory is responsible for housing the mounting of the computer’s external devices such as USB sticks.
/mnt directory
The /mnt directory serves to temporarily mount devices, partitions, and also file systems, which are on a CDROM, for example.
/opt directory
This directory contains the files of applications that are not official installations.
/sbin directory
Similar to /bin, it can contain files that are needed for system startup.
But generally, the files in this directory are only used by the root user (system admin).
The name sbin is short for system binaries.
/tmp directory
Temporary files directory, we can insert files that we won’t need in the future, for some testing or checking something in them.
Note: files in this directory can be deleted at any time, that is, it is not a safe place to store files.
Some software suggests that the installation be done in /tmp, after it is completed the installation files are removed from the system.
/usr directory
The /usr directory houses files that are only used in a read-only format by the system.
For example, man command files explaining what each command does and also other types of documentation.
/var directory
In the /var directory we will have a very large range of variable files.
From log files, MySQL, email inbox files, and even web servers.
Linux file structure conclusion
Important information Directory = Folder
We have several important directories under Linux, of course, you won’t save them all and what they do.
But it’s good to have a superficial notion because some actions we perform use some of these and also to know their importance to the system.
And that’s it for today, until the next post!