Atlas - 01-filesystem-hierarchy.md

Home / doc / linux-ref / docs / chapters / 02-filesystems Rendered HTML view | Size: 9080 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]

The Linux Filesystem Hierarchy

The Linux filesystem hierarchy is a standardized directory structure that defines the organization of files and directories on a Linux system. It is based on the Filesystem Hierarchy Standard (FHS) and is used by most Linux distributions.

Standard Hierarchy

According to the Free Desktop Organization, the standard Linux filesystem hierarchy is as follows:

Each of these directories has a specific purpose and contains specific types of files.

/bin

The /bin directory contains executable binaries that are essential for the system and can be ran by all users. In here you will find common commands such as ls, cp, mv, rm, and many more.

/boot

The /boot directory is where the kernel and its related files are stored. This directory is critical for the boot process, as it contains the kernel image and the initial RAM filesystem (initramfs) that the kernel uses during boot.

If you open this directory, you should see three important files:

Here is what my /boot directory looks like:

[root@arch boot]# ls -l total 24916 drwxr-xr-x 6 root root 4096 Mar 19 19:50 grub -rwxr-xr-x 1 root root 9038759 Mar 19 19:50 initramfs-linux.img -rwxr-xr-x 1 root root 16466432 Mar 19 19:50 vmlinuz-linux 11 [root@arch boot]#

Vmlinuz

Virtual Memory LINUx gZip. This is the compressed Linux kernel image. When the system boots, the bootloader loads this image into memory and decompresses it to start the operating system.

RAM Disks

A RAM disk is a virtual disk that resides in the system’s RAM. It is used during the boot process to provide a temporary root filesystem before the actual root filesystem is mounted. This allows the kernel to load necessary drivers and modules. This is because things like controller drivers for disks and other devices may not work without the RAM disk.

Types of RAM Disks

Linux supports these compressions on the kernel and initramfs images:

Note: The kernel can not load the initramfs if it is compressed with a compression algorithm that the kernel has not been compiled with support for. Ensure you enable support for the compression algorithm using menuconfig

/dev

The /dev directory contains device files that represent hardware devices and virtual devices on the system. These files allow user-space programs to interact with hardware and system resources without needing to interact with the hardware directly. This increases security and stability since you can give file permissions to these device files and control who can access them.

A brief overview of device files

In this list, * denotes a wildcard matching any characters.

Disks
Terminals
Network Interfaces
Sound Devices
USB and Input Devices
Misc Devices
Non-hardware Devices

/etc

The /etc directory contains host-specific system configuration files. Many of these are not related to the kernel and more used by user-space programs.

Privileged users can usually only edit these files

/home

The /home directory contains the home directories for regular users. Folders are owned by the user and have permissions set to allow the user to read, write, and execute files within their home directory.

User configuration files are stored in the directory with a dot prefix, such as .bashrc and are also stored in the .config and .local directories. These files and directories are hidden by default.

/lib

The /lib directory contains essential shared libraries and kernel modules. These libraries are required for the system to boot and run basic commands.

/media

The /media directory is used for mounting removable media:

You may also see:

But these are not standardized and may not be present on all systems.

/mnt

The /mnt directory is a temporary mount point for mounting filesystems. It must not be used for permanent mounts. It is typically used by system administrators when they need to mount a filesystem temporarily for maintenance.

/opt

Optional application software packages are stored in the /opt directory. This is where third-party applications that are not part of the standard distribution can be installed.

/proc

The /proc directory is a virtual filesystem that provides process and kernel information as files. It is used to access information about the system and running processes and is managed by the kernel.

/root

The /root directory is the home directory for the root user. It is separate from the /home directory to ensure that the root user's files are kept separate from regular users' files.

/var

The /var directory contains variable data files. This includes log files, spool files, and temporary files that are expected to grow in size over time.

/usr

The /usr directory is a secondary hierarchy for read-only user data. It contains the majority of user utilities and applications. This includes subdirectories such as:

/sbin

Administrative system binaries are stored in the /sbin directory. Similar to /bin, but these are intended for use by the system administrator and system itself.

/srv

The /srv directory contains data for services provided by the system. This can include web server files, FTP server files, and other service-related data.

[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.