The Linux file system has a standardized structure where each directory serves a specific purpose. In this article, I will explain what each directory does, starting from the root directory.
/ – Root Directory
This is the directory where all the files that make up Linux and the operating system exist. This main directory is represented by a slash.
All subdirectories, including hardware, user files, system settings, temporary files, and virtual directories related to the kernel, are located under /.
/bin – Essential User Binaries
The bin directory is where binary, i.e., executable files, are stored. This directory contains executable files for tools like the ls command.
/boot – Boot Loader Files
This directory contains the files required during the boot process of a Linux system. Before the operating system is fully loaded, the files in this directory are used to start the system.
/dev – Device Files
Contains representative files of all hardware devices and some virtual devices on the Linux system. Each file in this directory represents a hardware component or a special device file that provides access to system resources.
In Linux, everything is considered a file. Hardware is also represented using this logic. For example, a hard disk, a terminal, or even a random number generator appears here as a file.
/etc – System Configuration Files
This is the central location for all configuration files in the Linux system. From network settings to user accounts, service configurations to startup scripts, the files that determine how the system behaves are found here.
This directory is for system-wide configurations — not specific to individual users, but for the entire system.
/home – User Home Directories
This directory stores the personal files of standard user accounts on the system. A separate folder is created here for each user, and that folder is referred to as the user’s home directory.
/lib – Essential Shared Libraries
Contains the shared library files required for the essential commands and programs in the system to function. This directory especially includes dynamic libraries that commands in /bin and /sbin depend on.
/media – Removable Media Mount Point
This is the directory where external devices (USB drives, CD/DVDs, external disks, SD cards, etc.) are automatically mounted by the system when connected.
/mnt – Temporary Mount Point
A temporary directory reserved for file systems manually mounted by system administrators. External disks, network shares (NFS, Samba), ISO files, or another partition are often manually mounted under this directory.
This directory is reserved for manual operations rather than automated system processes.
/opt – Optional Add-on Applications
This is the directory used for optional, third-party software and packages on the Linux system. It typically contains applications installed manually, not via the system’s package manager.
/proc – Process and Kernel Info Virtual Filesystem
A virtual file system created by the Linux kernel that provides real-time information about the system and running processes. This directory does not contain actual files on disk; its contents are dynamically generated by the kernel.
/root – Home Directory for Root User
This is the personal home directory of the root (superuser) account on a Linux system. While the home directories of regular users are located under /home, the root user’s home directory is directly under the root of the system as /root.
/run – Runtime Variable Data
This directory stores temporary data files generated during runtime in the Linux system. It holds data like process information, lock files, and service PID files after the system boots.
/sbin – System Binaries
/sbin contains administrative commands necessary for system management and maintenance. These commands are generally not used by regular users; they are typically executed by root or users with sudo privileges.
This directory contains commands crucial for tasks such as system startup, repair, and network configuration.
The commands in /sbin are vital to the system, which is why many distributions restrict access to these commands to the root user.
/srv – Service Data
This directory stores data files for services running on the system. It is specifically designated for server services like web servers, FTP servers, and version control systems.
/sys – System and Hardware Info Virtual Filesystem
A virtual file system provided by the Linux kernel that gives information about system hardware and the kernel. Known as the sysfs file system, it presents detailed data on kernel modules, device drivers, and other hardware-related elements.
/tmp – Temporary Files
A directory where temporary files are stored by the system and users. Programs, services, or users can create short-term files here.
/usr – Secondary Hierarchy for Read-Only User Data
This is the second-level hierarchy for user applications and shared data in the Linux file system. Independent from the system’s core file structure, this directory contains most programs, libraries, documentation, and other resources.
/var – Variable Files
A directory where dynamic and constantly changing content is stored in the Linux system. Files that grow, shrink, or change regularly while the system is running are found here.
Stay secure! 🛡️