Simple explanation of the Linux file structure

Even though the current Linux “Operating System”, due to the availability of various user-friendly Desktop Environments, such as KDE Plasma, Cinnamon and Gnome, is very accessible and usable for the novice Linux user, there will soon be a moment that you will come into contact with the Linux file structure. And then it is useful if you at least know what happens in the different system folders. In this article a simple explanation of the Linux file system. I will give a brief description of most folders in the standard structure of the Linux File System. In future blog posts I will dive a bit deeper into the meaning of some of the individual folders and their content.

Start from the root

We start with the actual root (do not confuse with the folder “root”), which is indicated with “/”, or the forward slash. This is the starting point for the Linux folder structure, where everything is hung up. For example within Linux Mint you can open this folder layer by clicking on “File System”.

It is important to know that only the root user has write permission in this folder. For example, it is not possible as a normal user to create a new folder under “/”. To do this, you first have to choose “Open as root” and enter the password of the root before you can create a folder or save a file here.

The Linux file structure

  • bin: This folder contains the User Binaries. This concerns the general Linux commands that are used in single-user mode by all system users, such as ls (show all underlying files and directories), dir (show all underlying directories) and help.
  • boot: Contains boot loader related files so that your Linux distribution can be booted correctly.
  • dev: The dev directory contains device files, or all components of your system. What is important here is to realize that all components of the system or connected to it are displayed as a folder, such as a USB drive, an audio device and a monitor.
  • etc: Here are the configuration files used by the programs. This concerns the nerve center of Linux where the operation of all processes is maintained.
  • home: Here are the home directories, containing all personal data and files, of all users known in the system, such as /home /johnbeen. Every user gets his own home folder.
  • lib: Contains library files that support the binary files under /bin and /sbin.
  • media: Here are the folders linked to Removable Media devices, such as /media/cdrom, /media/floppy and /media/cdrecorder.

  • mnt: This is a temporary folder where system administrators can temporarily mount filesystems (Mounting is linking a storage device to a specific location in the folder structure).
  • opt: Is intended for Optional add-on Applications, or optional add-ons of individual software providers.
  • proc: This folder contains information about system processes.
  • root: As already indicated at “/”, there is a special root user who only has access to all administrative possibilities within the system. This user is called “root” and has its own personal folder. “/Root” is the home folder of root, which is not the same as the “/”, so the root folder under which all system folders are suspended.
  • run: The /run directory is a “companion” directory for the var directory (var /run), similar to /bin, which is a companion directory for /usr /bin. This involves so-called run-time variable data, or information about running the system from the most recent boot with respect to logged-in users and active daemons (computer program running in the background).
  • sbin: In contrast to bin, where the users can find binaries, the system binaries can be found in sbin. These executables are not accessed by ordinary users, but by the system administrator with the aim of system maintenance. Think of executables like reboot, fdisk and swapon.
  • srv: Contains service data for specific servers.
  • sys: Contains, among other things, driver information for connected devices.
  • tmp: The Temporary Files, or temporary files created by programs or by users. When the system is rebooted, these files are deleted.
  • usr: Here are the User Programs, such as binaries, documentation and source code. For example, /usr /sbin contains the binary files for system administrators and /usr /local users contain programs that you install from the source. For example /usr /local /apache2 for installing Apache.
  • var: Here are the variable files, or the files that the system expects to grow over time, such as log files, packages and database files, emails and print queues.

Hopefully the above explanation is giving a kind of an insight in the Linux file structure. In future posts some of these folders will be discussed a bit more in depth.

 

Leave a Reply