Linux File System Structure/Hierarchy

Linux File System Structure/Hierarchy

Linux is the 3rd most Used daily language and Most used language by Developers. So if you want to learn you need to know the file management system and its Structure




The file System structure is majorly different from the structures of Windows or Mac. Here the Administrative user is known as the root user whereas in Windows it is known as ADMIN. and instead of program files and windows folders, it has many different folders based upon the usage and functionalities.

Linux File System

Before starting to learn about the Linux Commands we need to know about the file system in Linux. Most of you guys might be windows users or even Mac users but the file system structure of Linux is different from both of them. Linux has a directory Structure where the base or root node/folder is called the root folder. The root folder starts with "/" and every other file in a Linux system comes under the root folder. Linux uses a variable or way to identify the files and folders which is known as INODE value. The inode values of any 2 files of the folder do not match. And the default inode value of the root node is 2 this is an important point to be noted. We can see the inode values by using -I with any file manipulation commands which we are going to discuss.


So there are some Folders in Linux and we need to know the configurations and needs of the folders to understand the files system. Each of these folders has its own specific files stored in it. These folders are stored in the root directory or "/".

  • "/":             First of all, is the root directory which starts with "/" so every path in the Linux system starts with "/"
  • /bin:            Bin is the file where all the binary files are stored or the Executable files are stored here. This folder doesn't have any permission for anyone can view them. All the default applications and command files of Linux are stored here. We can tell what type of applications are stored on the system by looking into the bin folder

  • /dev:            This is considered to be a special folder. Anyone or any device and read or write data into the dev folder. Mostly the device drivers are also stored here. The devices attached to the system can be view here for example when we mount a printer we can see a file called /dev/printer in this folder.
  • /etc:             It contains all the configuration files of the operating system and all the Web files. Configuration files mean the details of the permission given to the users and group configurations. One more point to be noted here is that the 2 most important files are also stored here for which every attacker or pentester looks for which shadow file and passwd. Shadow file consists of all the detailed information about the passwords of the users and passwords changes and all are stored in encrypted form. passwd file also has the password hashes of all the users and groups it also tells the names of the users present in the system. This file is a globally readable file anyone can see the information in it. 

  • /boot:           This folder has all the kernel information and the codes needed to boot the system. All the kernel details the version details updates are stored here.
  • /mnt:            This directory is used to store the mounted devices such as pen drives, USBs, CDROMs, floppy discs, etc. When we want to use an external storage device then we need to plug the devices and look for the data in it in the /mnt folder all the mounted devices can be read and write here.
  • /opt:             This is where we can install other optional software from third-party vendors or distributors. Users can install the additional add-on software here. If we store all the software in a boot or bin folder then the space of those folders will increase so we are separating the OS packages and software from third-party software.
  • /lib:               As we talked earlier the boot folder has all the codes needed to boot the system and the bin has all software codes but there are some sources files or libraries needed or helpful for the proper functioning of that software the codes are stored here. All the kernel modules are also stored here about the kernel updates etc.
  • /usr:              This is similar to the /user folder in windows. Here we have all the users made folders and users manipulated data. One user cannot access another user's folders without the username and password. So the user folders are isolated from each other. It can also contain a secondary hierarchy such as all the folders which we are discussing can also be there in every user's folder.

  • /tmp:           Temporary system files are stored here example the downloads of browsers if no location is given, cookies, Temporary user data all are stored here. This is temporary because all the data in this folder is deleted after the system is rebooted.
  • /sbin:           SBIN is a Standard directory for the root folder. It contains all the EXE files or executable files. These are mostly administrative tools that are only made or used by root users. These are also the programs which are not need to boot in the time of system boot
Some Additional important Folders and locations are:
  • /proc:          This folder contains the process information which is running in the system like process id's system usages disc usage etc. As it has the process information it also sometimes provides a medium between users and the kernel for communications of process and information. It also has the information of the commands which are used in the terminal or command line.
  • /srv:           Site-specific Data are stored here. Like a webserver data or other services data like an HTTP server or an FTP server's data.
  • /var:           This folder acts as a check to the other folders it has the information of the folders and user data, temporary files, and the logging data and administrative data. It also has an important folder called /var/www where the server details are stored when we are hosting a website from our device using apache or tomcat etc.


Post a Comment

Previous Post Next Post