Demystifying the Linux Directory Structure

Kaustave DharKaustave Dhar
5 min read

Introduction:

The Linux operating system, known for its robustness and versatility, is built upon a well-defined directory structure. Understanding this structure is crucial for both beginners and experienced users, as it forms the foundation for organizing and accessing files and directories. In this technical blog, we will explore the Linux directory structure, delve into its key components, and gain insights into how it contributes to the overall functioning of the system.

  • Table of Contents:

    • The Root Directory

    • Essential Directories

      • /bin and /sbin

      • /etc

      • /home

      • /lib and /lib64

      • /usr

      • var

    • Special Directories

      • /dev

      • /proc

      • sys

      • /tmp

    • User Directories

    • Conclusion

      1. /bin : (user Binary files) -> whatever you are going to store will be located into binary files. -> The command generally you have is creating a user, file, and directory, everything will be stored in /bin.

      2. /boot : (Boot loader files) -> in windows you might have seen some system-reserved partitions into the OS -> same as Windows OS, it contains booting files installed into this directory by default. -> you will find grub , or grub2 as your booting firm.

      3. /dev : (Device files) -> in this it contains all the devices files. -> If you are connected to your hard disk, if you have created a partition entry to the hard disk, all will store in /dev. -> For the USB drive, if you do use a DVD or CD drive, this again will be stored in the /dev. -> Any devices, directly attached or a removable or a hot plugin play device, will be stored into /dev.

      4. /etc : (Configuration Files) -> Whatever the configuration you do, -> you define a hostname, confirm an IP address, you configure some servers such as FTP or any server. -> all services, all settings will be stored in /etc.

      5. /home : (Home Directories) -> it contains the home directory of the user. -> We can have single or multiple users in linux OS. -> So when this user/users logged in, all the data which they are going to create in their desktop, on their docs, any directories -> all this will be created and saved in /home directory. -> for user1, it will be /home/user1 directory--> everuthing will be stored from this point onwards. -> same for user2, 3 etc -> This is for the standard user and non-root super user.

      6. /lib : (system libraries) -> it contains all the library files. -> If you want some help or help in particular command, parameter in the command, so all the help option you get into the /lib.

      7. /media: (Mount point of removable media) -> This directory is created so that you can find this particular hot plug-and-play devices automounted over here.

      8. /opt : (optional add-on applications) -> all the optimized data whatever you have will be stored into these /opt.

      9. /sbin: (system binaries) -> it's a super bin -> previously /bin was used for all binaries files, but -> these binary files are only for the standard users and not other users. -> super user or root user is like admin, he has access to everything in Linux OS. and it uses /sbin to store its binary files.

      10. /srv: (service data) -> all the services-related data, like -> which services are on, which services have started on the boot or which services are stopped. -> All these services-related data will find in /srv

      11. /tmp : (temporary files) -> It is used for the temporary task, like -> copying a DVD, from one drive to the harddisk, or you are creating dvd to dvd images. -> so it temporarily stores the data in your RAM for a particular period. -> Once your system rebooted, these temp files get flushed out. -> hence known as volatile storage for Linux OS

      12. /usr : (User Program) -> it contains all the user programs. -> You have installed some packages or you have downloaded some programs into the Linux package.

      13. /var : (Variable Files) -> It contains all the variable files. -> Varibale files or data are those things that generally change. -> eg you have declared the IP address to your machine in a dynamic way and hence IP changes, and so is DHCP. -> so those data which generally change are stored into /var.

      14. /root : (Root user Directory) -> /root is the home directory of the superuser root. -> /home contains the standard users home directory -> but root stores its complete data in a different directory called /root.

      15. /proc : (Process Information) -> This contains the information abt the devices you have connected and their process. -> I have connected a memory that is used by the system, we can see if the memory is completely utilized or not. -> What is the process, what is the progress rate etc?

Conclusion:

Understanding the Linux directory structure is fundamental for effectively navigating the operating system and managing files and directories. By familiarizing ourselves with the root directory, essential directories, special directories, and user directories, we gain a comprehensive understanding of how the system is organized and can harness its power to maximize productivity and efficiency.

Remember, the Linux directory structure is designed to provide a logical and hierarchical organization of files, making it one of the key strengths of the Linux ecosystem. So, dive in, explore, and leverage the power of this well-structured directory system to unleash the true potential of Linux. Happy navigating!

Note: The blog post provides an overview of the Linux directory structure. For a more detailed understanding, readers are encouraged to explore additional resources and documentation.

0
Subscribe to my newsletter

Read articles from Kaustave Dhar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Kaustave Dhar
Kaustave Dhar