Appendix B - Linux File System Hierarchy
/
├── /bin - Essential User Binaries
├── /boot - Static Boot Files
├── /dev - Device Files
├── /etc - Configuration Files
├── /home - Home Directories
├── /lib - Essential Shared Libraries
├── /media - Removable Media
├── /mnt - Temporary Mount Points
├── /opt - Optional Packages
├── /proc - Process Information
├── /root - Root Home Directory
├── /sbin - System Binaries
├── /srv - Service Data
├── /tmp - Temporary Files
├── /usr - User Binaries
│ ├── /usr/bin - Binaries
│ ├── /usr/sbin - Non-essential system binaries
│ ├── /usr/local - Local hierarchy (empty after main installation)
│ └── /usr/share - Architecture-independent data
└── /var - Variable Data Files
The Root Directory - /
Every single file and directory starts from the root directory. It's denoted by a forward slash /
. Only the root user has write privilege under this directory.
/bin - Essential User Binaries
The /bin
directory contains essential binary executables that are needed for booting, repairing, and for minimal functioning of the operating system. Examples of files in this directory are bash
, ls
, cat
, cp
, etc.
/boot - Static Boot Files
The /boot
directory contains the static files required to boot the operating system, such as the Linux kernel (vmlinuz
), initial RAM disk image for drivers (initrd.img
), and the boot loader (GRUB).
/dev - Device Files
/dev
is a special directory that contains device nodes. Linux treats devices as files, and the /dev
directory contains a variety of special files that represent devices, such as hard drives, sound devices, etc.
/etc - Configuration Files
The /etc
directory contains configuration files that are local to the machine. System-wide environment settings can also be found here.
/home - Home Directories
This is the directory where users will store personal files. Every user will have a sub-directory with their name under /home
where they can keep their files.
/lib - Essential Shared Libraries
The /lib
directory contains kernel modules and shared library images required to boot the system and run the commands in the root file system.
/media - Removable Media
The /media
directory is used as a temporary mount point for removable devices, such as USB sticks, CD-ROMs, etc.
/mnt - Temporary Mount Points
The /mnt
directory is used for temporarily mounted filesystems. It’s intended for temporary mount operations performed by system administrators.
/opt - Optional Packages
The /opt
directory is reserved for all the software and add-on packages that are not part of the default installation.
/proc - Process Information
The /proc
directory is a virtual filesystem that provides a mechanism for kernel to send information to processes.
/root - Root Home Directory
/root
is the home directory of the root user and is not related to the root directory /
.
/sbin - System Binaries
Like /bin
, /sbin
also contains binary executables. But, the binaries inside /sbin
are used typically by system administrator, for system maintenance purpose.
/srv - Service Data
The /srv
directory contains data for services provided by the system.
/tmp - Temporary Files
The /tmp
directory is a place for storing temporary files needed between system reboots.
/usr - User Binaries
/usr
is one of the largest directories in the Linux filesystem. It contains all the executable binaries, libraries, manual pages, and other read-only data.
/var - Variable Data Files
The /var
directory is used to store files to which the system writes data during the course of its operation.