Categories: How-To

How does the directory structure work in Linux? Understand!

If you like to better understand how operating systems work, you must have wondered how the Linux directory structure works, right?

This is a very common question and, by the way, very important.

After all, understand topics such as:

  • What is a Linux directory;
  • what are the differences between it and Windows;
  • and what are, in fact, the main Linux directories.

If you want to better understand how this whole universe works, just keep reading! The Linux Certification team developed this complete content, with everything you need to know about the topic. Follow up!

What is a Linux directory?

A Linux directory is simply a file, which is distributed in the form of a hierarchy. There are several directory structures, with “root” as root, or principal (given by the “/” symbol).

From there, other files and main commands can be opened, viewed, and organized, triggered by specific commands that identify them.

To find specific files, such as binary structures, for example, there is the “/bin” command. With it, all the results that match the search will be shown.

Differences in the Linux directory structure for Windows

In the Windows operating system, the directory structure also exists and has the same purpose: to organize and facilitate access to all the files present in the system and in their respective folders.

However, the difference is in the way they were developed. Windows, for example, emerged at the time of microcomputers, when several hard disk partitions began to exist and be used, such as C: and D:, and are initialized together with the OS.

Linux, in turn, depends on its Linux partitions being created and activated, managing the “bootable” system ”.

This advantage of Linux makes the Linux directory structure flexible and activated locally, without necessarily having to define a partition to run it.

This makes Linux easier to understand and operate, starting with the root system (or root “/”), which has some specific directories with different functionalities, as you will see below.

Understand the main Linux directories

Photo: Pexels | Main Linux directories.

The main Linux directories are those most used and most useful in the daily life of an IT professional. To check which are the 6 main ones we selected, just check below!

1. (/) Root/Root

The Root directory, also known as “Root” (its literal English translation), is represented by the backslash (/) command. It is within it that all other directories and commands are located.

In a directory hierarchy, it is the main one, which encompasses any other. Thus, only the user with administrator access, the “root” user profile, can make modifications and create new files.

In this way, human errors are avoided and important information is not at risk of being modified or even deleted from the root directory.

2. /bin

/bin, in turn, represents the location of all binary files, that is, commands to perform essential system functions.

Only with it is possible to explore the text and network resources of the operating system. It is important to remember that, because it has this feature, /bin stores all executable files, that is, that any user of the system can use.

Some important components of the Linux Shell can be found here, such as bash, and activated by specific commands.

3. /sbin

Similar to /bin, /sbin also includes executable directories, but structure administrators use it only to make occasional changes to the system.

As it represents a set of executable applications, it is entirely possible to monitor systems and networks, in addition to changing the partitions and configurations of the HD (hard disk or hard disk).

With its help, hardware and other software items can be managed and maintained safely. An example is the possibility of addressing IPs correctly.

4. /usr

Most apps and software stored on /usr are available to all users regardless of their permission level.

They are several executable files that allow actions to copy file source code. This directory can be run in conjunction with the two previous ones, as follows:

  • /usr/bin: which contains all binary files (triggered by /bin), which can be viewed by any user, not just the administrator;
  • /usr/sbin: shows only the binary files that are essential to the administrator, to which only the administrator has access.

5. /etc

If you need to configure any file or software, the information will be here, in /etc. even DNS solutions are found in this directory.

Also, if you want to interrupt or boot any system through exclusive scripts, just search for them here.

6. /lib

As you may already know, there are several command libraries that can be activated as shortcuts. They are located in the /lib directory.

If you came from the Windows universe, know that this directory is very similar to System, or System32, as it is also called.

Commands for creating and manipulating directories on Linux

Photo: Pexels | Main Linux directory commands.

You may be wondering how it is possible to manipulate and change Linux directories. The truth is that the CLI (Command-line interface) option is the most recommended in this case.

This means that the commands are activated in a terminal, which serves as the interface or “bridge” between the user and the Linux kernel, or its “essence”.

Check out this list of commands that can be very useful in your daily life:

  • mkdir: create file directories (or a sequence of them);
  • rmdir: remove a specific directory (or more, depending on your need);
  • rm: to remove specific information within the file system;
  • mv: to move files or rename them;
  • cp: responsible for copying files from specific directories, in addition to being very useful when backing up system information and replicating them to another directory.

This information is just the “tip of the iceberg” and you can study it much more thoroughly.

The best way to do this is with the help of our online courses. The Linux Certification presents only the best materials on the teaching platform for you to learn Linux.

A teacher with decades of experience in the field will be your tutor, transmitting information in the simplest, didactic and clear way possible.

Plus, you’ll be part of an incredible community with over 14,000 students. This contact can open many doors in your career, in addition to preparing you for the main Linux certifications on the market.

It’s worth checking it out and testing with our 7-day free offer. You won’t regret joining the community and having access to the teacher to answer all your questions!

Learn much more about Linux in our online course. Sign up for a free 7-day trial!

Uirá Endy Ribeiro

Uirá Endy Ribeiro is a Software Developer and Cloud Computing Architect with a 23-year career. He has master's degrees in computer science and fifteen IT certifications and is the author of 11 books recognized in the IT world market. He is also Director at Universidade Salgado de Oliveira and Director of the Linux Professional Institute - LPI Director's Board.

Uirá Endy Ribeiro

Uirá Endy Ribeiro is a Software Developer and Cloud Computing Architect with a 23-year career. He has master's degrees in computer science and fifteen IT certifications and is the author of 11 books recognized in the IT world market. He is also Director at Universidade Salgado de Oliveira and Director of the Linux Professional Institute - LPI Director's Board.

Recent Posts

Sudo command on Linux (privilege scale) [Basic Guide]

The sudo command on Linux executes a given command as if it were another user.…

2 years ago

SS command on Linux (investigate the network) [Basic Guide]

The ss command on Linux is extremely useful for investigating sockets, providing various information about…

2 years ago

Free Linux command (memory usage) [Basic Guide]

Free Linux command shows the amount of total memory in use and available, as well…

2 years ago

Linux while command (loop – while) [Basic Guide]

The shell has structures for testing conditions and executing certain program sequences several times (loop),…

2 years ago

Linux fstab file (disk mount setup) [Basic Guide]

The /etc/fstab file stores the configuration of which devices should be mounted and what is…

2 years ago

Netcat command on Linux (Swiss network knife) [Basic Guide]

The Netcat Command in Linux or nc is a utility used to do “almost anything”…

2 years ago

This website uses cookies.