Linux Filesystem Hierarchy: Directory Structure

Linux Filesystem Hierarchy: Knowing the Directory Structure in Linux. Once you have migrated from Windows to Linux you may notice that the filesystem is not what you are accustomed to. Of the first things a new Linux user needs to understand is the inner workings of the file system hierarchy in Linux. Knowing this early on will help you to become oriented with and hopefully confident in navigating and using this directory structure.

Linux filesystem directory structure
Linux filesystem Hierarchy - Navigating directory structure in Linux

What is the Filesystem Hierarchy Standard (FHS)?

The Filesystem Hierarchy Standard (FHS) is a set of guidelines that defines the directory structure and directory contents in Linux and other Unix-like operating systems. It was designed to create a consistent environment, making it easier for users to understand the layout of the filesystem and ensuring compatibility across distributions.

Understanding the FHS is crucial for both new and experienced Linux users, as it ensures that software and system administrators can find system files in the same locations, regardless of which Linux distribution they are using.

Understanding the Linux Filesystem Directory Structure

To help you better understand the generic Linux directory structure, each directory is listed below. Each directory is followed by an explanation of what it is most commonly used for.

Linux Directory Purpose of the Linux Filesystem Hierarchy
/bin Essential system utilities for diagnosing, repairing, and managing the system.
/boot Boot loader programs and configuration files required for system startup.
/cdrom Shortcut to the CD/DVD drive for accessing optical media.
/devbootstrap Files generated during the installation of Ubuntu, primarily used during bootstrapping.
/dev Virtual files representing hardware devices on the system.
/etc Central location for system-wide configuration files.
/home Personal directories and files for each user.
/initrd.img Symbolic link to the ramdisk used during the Linux boot process.
/lib Shared system libraries and essential runtime files.
/lost+found Directory for salvaged files recovered after an improper system shutdown.
/media Mount point for removable storage devices like USB drives and external hard disks.
/mnt Temporary mount point for externally mounted filesystems.
/opt Directory for optional additional software not critical for system operation.
/proc Virtual filesystem containing information about system processes and kernel settings.
/root Home directory for the root user, the system administrator.
/sbin System administration binaries and essential system binaries.
/srv Location for service-specific data and configuration files for network servers.
/sys Mount point for Sysfs, a virtual filesystem used by the Linux kernel to interact with hardware.
/tmp Temporary directory for storing files needed for a short period.
/usr Shared system resources, including executables, libraries, and documentation.
/var Constantly changing data such as logs, spool files, and temporary files generated by processes.
/vmlinuz Symbolic link to the kernel file used during system boot.

Understanding the Linux Filesystem Hierarchy is crucial for anyone looking to navigate and use Linux effectively. With this knowledge, you'll be able to easily locate files, manage directories, and troubleshoot your system with greater ease. While this guide covers the essential directories and their purposes, there’s much more to learn as you continue your Linux journey.

If you're new to Linux, taking the time to familiarize yourself with the filesystem will empower you to feel more confident and capable as you explore this powerful operating system.

Other Sections You Might Find Useful

  • Find a File in Linux: Need help locating files in your Linux system? This guide will show you various methods for finding files efficiently.
  • How to Use the chmod Command in Linux: The chmod command is essential for changing file permissions in Linux. This guide will show you how to use it to control who can read, write, and execute files on your system.