Exploring the Linux File System: A Detailed Guide to Understanding Each Folder

Sai Kiran Pikili
4 min readJun 1, 2024

--

The Linux file system is a structured hierarchy that organizes all the files and directories on your system. For those new to Linux, navigating this file system can seem daunting. In this blog, we will explore the Linux file system in detail, explaining the purpose of each folder within the root directory.

The Root Directory (/)

The root directory, denoted by a single forward slash (/), is the top-level directory in the Linux file system. Every file and directory on a Linux system is contained within this hierarchy. Here’s a breakdown of the key directories found in the root directory:

/bin - Essential User Binaries

The /bin directory contains essential command binaries (executable files) that are necessary for booting and repairing the system. These commands are available to all users and include basic commands such as ls, cp, mv, rm, and cat.

/boot - Static Boot Files

The /boot directory holds the files needed for the booting process. This includes the Linux kernel, initial RAM disk images, and bootloader configuration files. Key files include:

  • vmlinuz: The compressed Linux kernel.
  • initrd.img or initramfs.img: Initial RAM disk used during the boot process.

/dev - Device Files

The /dev directory contains device files, which are special files that represent hardware devices. For example:

  • sda: Represents the first SATA hard drive.
  • tty: Represents terminal devices.
  • null: A special file that discards all data written to it.

/etc - Configuration Files

The /etc directory contains system-wide configuration files and shell scripts used to boot and initialize the system. Notable files and subdirectories include:

  • passwd: User account information.
  • shadow: Secure user account information.
  • fstab: Filesystem mount points.

/home - User Home Directories

The /home directory contains a subdirectory for each user on the system. These subdirectories hold personal files, configuration settings, and directories for each user. For example:

  • /home/alice: The home directory for the user alice.

/lib - Essential Shared Libraries

The /lib directory contains shared library files needed by the essential binaries in /bin and /sbin. These files typically have names starting with lib, such as libc.so.6, which is a crucial C library.

/media - Mount Points for Removable Media

The /media directory is used as a mount point for removable media such as USB drives, CD-ROMs, and other external storage devices. When a device is mounted, a subdirectory is created under /media.

/mnt - Temporary Mount Points

The /mnt directory is used for temporarily mounting filesystems. System administrators can use this directory to mount storage devices or partitions temporarily.

/opt - Optional Software Packages

The /opt directory is reserved for the installation of additional software packages. Third-party applications that are not part of the default Linux installation are often installed here.

/proc - Process Information

The /proc directory is a virtual filesystem that contains runtime system information. It is dynamically generated by the system and includes information about system processes, hardware configuration, and kernel parameters. Key files and directories include:

  • /proc/cpuinfo: Information about the CPU.
  • /proc/meminfo: Information about memory usage.
  • /proc/<PID>: Directories containing information about each running process.

/root - Root User Home Directory

The /root directory is the home directory for the root user (the system administrator). Unlike /home, this directory is not intended for regular users and is only accessible by the root user.

/run - Runtime Variable Data

The /run directory stores transient files that describe the system since it was booted. These include process identifiers (PIDs), lock files, and other state information.

/sbin - System Binaries

The /sbin directory contains essential system binaries used by the root user for system administration tasks. These include commands such as fsck, reboot, and ifconfig.

/srv - Service Data

The /srv directory contains data for services provided by the system, such as web servers or FTP servers. For example, data served by a web server might be stored in /srv/www.

/sys - System Information

The /sys directory is another virtual filesystem that provides information about the system and connected devices. It is used by the kernel to export information about devices so that it can be easily accessed by user-space programs.

/tmp - Temporary Files

The /tmp directory is used to store temporary files created by system processes and user applications. Files in this directory are often deleted at boot or after a specified period.

/usr - User Utilities and Applications

The /usr directory contains user-installed software and utilities. It is subdivided into several directories, including:

  • /usr/bin: Non-essential user binaries.
  • /usr/lib: Shared libraries for binaries in /usr/bin and /usr/sbin.
  • /usr/local: Local software installations and custom scripts.
  • /usr/share: Architecture-independent data, such as documentation and icons.

/var - Variable Data Files

The /var directory holds variable data files, which are files that change frequently, such as logs, mail spools, and printer spools. Key subdirectories include:

  • /var/log: System and application log files.
  • /var/mail: User mailboxes.
  • /var/spool: Tasks waiting to be processed, such as print jobs.

Conclusion

Understanding the Linux file system is crucial for effective system management and navigation. Each directory under the root (/) directory has a specific purpose, ensuring that the system remains organized and efficient. Whether you are a new user or an experienced system administrator, knowing the layout and function of these directories can help you better manage your Linux environment.

--

--

Sai Kiran Pikili
Sai Kiran Pikili

Written by Sai Kiran Pikili

Architecting seamless DevOps solutions 🚀 Automating workflows, enhancing reliability, and empowering innovation to fuel the future of technology 🌟

No responses yet