The Linux file hierarchy follows a standard directory structure known as the Filesystem Hierarchy Standard (FHS). Here’s an overview of the key directories and what they typically contain:
/
(Root Directory)- The top-level directory in the file system. All other directories and files are contained under this root directory.
/bin
(Binaries)- Contains essential command binaries (programs) needed for system booting and repairing. These are available for all users.
/boot
- Contains boot loader files, including the kernel, initrd (initial RAM disk), and other files needed to boot the system.
/dev
(Devices)- Contains device files that represent hardware devices (like
/dev/sda
for storage,/dev/tty
for terminals).
- Contains device files that represent hardware devices (like
/etc
(Configuration Files)- Contains system-wide configuration files for the operating system and installed applications (e.g.,
/etc/passwd
,/etc/network/
).
- Contains system-wide configuration files for the operating system and installed applications (e.g.,
/home
- User-specific directories. Each user typically has a subdirectory here (e.g.,
/home/username
) where personal files and configurations are stored.
- User-specific directories. Each user typically has a subdirectory here (e.g.,
/lib
(Libraries)- Contains shared libraries and kernel modules needed to boot the system and run programs in
/bin
and/sbin
.
- Contains shared libraries and kernel modules needed to boot the system and run programs in
/media
- Mount point for removable media (CDs, DVDs, USB drives, etc.). Devices are typically mounted here when inserted.
/mnt
- A directory traditionally used for temporarily mounting file systems, like network shares or other disks.
/opt
(Optional Packages)- Contains optional software packages and third-party applications that are installed manually (not through the system’s package manager).
/proc
(Process Information)- Virtual filesystem that provides information about running processes, kernel parameters, and system statistics (e.g.,
/proc/cpuinfo
for CPU info).
- Virtual filesystem that provides information about running processes, kernel parameters, and system statistics (e.g.,
/root
(Root User’s Home)- The home directory for the root (administrator) user.
/run
- A temporary filesystem (usually mounted in RAM) that stores runtime data like currently running processes and other system states.
/sbin
(System Binaries)- Contains essential system binaries used for system maintenance and troubleshooting, typically by the root user.
/srv
(Service Data)- Contains data for services provided by the system, such as web server files or FTP server files (e.g.,
/srv/www
for web content).
- Contains data for services provided by the system, such as web server files or FTP server files (e.g.,
/sys
(System Information)- Another virtual filesystem that exposes kernel and device information (like
/sys/class
for device classes).
- Another virtual filesystem that exposes kernel and device information (like
/tmp
(Temporary Files)- A directory for temporary files created by programs and users. Files here are usually deleted when the system reboots.
/usr
(User Data)- Contains read-only user data, including applications and files that are shared among users. The directory is usually large and contains subdirectories like
/usr/bin
(user binaries),/usr/lib
(libraries), and/usr/share
(shared data).
- Contains read-only user data, including applications and files that are shared among users. The directory is usually large and contains subdirectories like
/var
(Variable Data)- Contains variable data files like logs, spool files, mail queues, and databases. It’s where dynamic content like system logs (
/var/log
) and mail files (/var/mail
) are stored.
- Contains variable data files like logs, spool files, mail queues, and databases. It’s where dynamic content like system logs (
This structure is designed to keep things organized and make it easier to manage, especially for system administrators. Would you like more details about any specific directory?