Linux Directory Structure

A Filesystem Hierarchy Standard (FHS) is something that the Linux Foundation keeps up to date. This FHS gives a definition of the structure of directories, as well as what they hold and what they do in Linux distributions. As a result of this FHS, the directory structures of each Linux distribution are nearly identical to one another. Let’s have a look at the Linux filesystem’s directory layout.

/ – The Root Directory

The root directory / is the starting point for every file and folder on your Linux system. The / directory is analogous to the C: directory in Windows; however, this is not entirely accurate since Linux does not use drive letters. On Windows, a second partition would be found at D:, but on Linux, it would be in a subfolder of /.

/bin — Essential User Binaries

The actual executable files for many of the most basic shell commands, like ls, cp, cd, and so on, are kept in the /bin directory. Here, the majority of the applications are stored in binary format, which makes them available to all users of the Linux system.

/boot — Boot Files

The /boot directory stores all of the files that are required for the system to be able to boot successfully. These include the files for the GRUB boot loader as well as your Linux kernels. However, the configuration files for the boot loader may be found in the /etc directory, along with the other configuration files. They are not placed here.

/dev — Device Files

This directory only includes unique files, such as those that are associated with the various devices. These are not actual files; they take up no space on the disk at all. Some instances of these files that are particularly fascinating. /dev/null is a command that can be issued to delete any file or string. /dev/zero is a device that stores an unlimited series of zeros, whereas /dev/random is a device that stores an infinite sequence of random values.

/etc — Configuration Files

The /etc directory stores the most important configuration files for the system. These files, which include the password file and networking files, are mostly used by the system administrator and services. If you need to change the system’s configuration (for example, if you want to change the hostname), you can find the files you need in this section.

/home — Home Folders

For each user, a personal folder is stored in the /home directory. If your username is elearnbee, for instance, your home directory is /home/elearnbee. The user’s personal data and settings are kept in their home directory. Users may only make changes to their own files in their home directory without gaining superuser privileges (logging in as “root”).

/root – The home directory of the root

If you log in as root, your home directory will be located in the /root folder. The location is /root rather than /home/root. This is different from the / directory, which is the root of the operating system.

/sbin – System binaries

If you’re familiar with the /bin directory, you’ll feel right at home in /sbin. It has all of the binaries that the root user needs to run in order to run the system.

/tmp — Temporary Files

This directory is where temporary files are kept, as the name suggests. This directory is used by a lot of programs to store temporary files. Even temporary files can be stored in a directory. But keep in mind that when your system restarts, the files in the /tmp directories are thrown away. Some Linux systems also automatically delete old files, so don’t save anything important here.

/usr — User Binaries & Read-Only Data

The /usr directory holds files and programs that users use, as opposed to programs and files that the system uses. For example, applications that are not essential are put in the /usr/bin directory instead of the /bin directory, and system administration binaries that aren’t essential are put in the /usr/sbin directory instead of the /sbin directory. The libraries for each can be found in the /usr/lib folder. There are also other directories in the /usr directory. For example, files that don’t depend on the architecture, like graphics, are in the /usr/share directory. By default, locally compiled applications are put in the /usr/local directory. This keeps them from messing up the rest of the system.

/var – Variable data files

Runtime data such as system logs, user histories, caches, and other files managed by the system are stored in a directory called var. Since these files are NOT removed automatically, they are a great resource for system administrators looking to get insight on user activity. Examining the contents of the /var/log/wtmp file, for instance, will provide you access to the Linux system’s login history.

Feedback

Do you want to provide us with feedback? Provide us with feedback directly at info@elearnbee.com.

Share us:

AD BLOCK 1