Kahibaro
Discord Login Register

Linux Filesystem Hierarchy

Why the Linux Filesystem Feels “Different”

If you come from Windows or macOS, Linux’s filesystem layout looks unfamiliar at first. There is:

This chapter gives you a big-picture tour of that tree and what makes Linux’s layout unique, without going into the finer details that are covered by the subchapters.

The goal: when you see a path like /etc/ssh/sshd_config or /var/log/syslog, you should immediately have a rough idea what kind of thing it is and why it lives there.


The Single Root: `/`

Linux organizes everything into a single directory tree that starts at the root directory, written as a single slash: /.

Some important consequences:

You will see paths written like:

These are absolute paths (more on that in the dedicated paths chapter).


Standardization: FHS and Why Layout Matters

The Linux filesystem layout is not random. It is largely guided by the Filesystem Hierarchy Standard (FHS), a document that describes what should go where.

Most major distributions roughly follow the same rules:

This consistency means:

Some distributions slightly vary (for example, some merge /bin into /usr/bin), but the overall structure and purpose of each major directory stay similar.


“Everything Is a File”

A core Linux idea is that “everything is a file” (or looks like one):

This uniform view lets you interact with many different things using the same tools:

You will learn about the exact file types (regular, directory, link, etc.) in the dedicated File types chapter; here it’s important to understand that the filesystem is more than just “documents and programs”.


High-Level Directory Map

Here is a conceptual map of what sits directly under / and what kinds of things you can generally expect to find there:

/
├── bin      - Essential user commands (often now linked into /usr/bin)
├── boot     - Files needed to start (boot) the system (kernel, bootloader)
├── dev      - Device files (disks, terminals, etc.)
├── etc      - System-wide configuration files
├── home     - Users’ personal directories and files
├── lib      - Essential shared libraries (often merged with /usr/lib)
├── media    - Mount points for removable media (USB drives, CDs)
├── mnt      - Temporary mount points for manually mounted filesystems
├── opt      - Optional/add-on software
├── proc     - Virtual filesystem exposing process and kernel info
├── root     - Home directory for the root user
├── run      - Volatile runtime data (like PID files, sockets)
├── sbin     - Essential system binaries (admin tools)
├── srv      - Data for specific services (web server, FTP, etc.)
├── sys      - Virtual filesystem for hardware and kernel interfaces
├── tmp      - Temporary files (cleared regularly)
├── usr      - Userland programs, libraries, documentation
└── var      - Variable data (logs, caches, mail, etc.)

You do not need to memorize this all at once. Focus first on the directories you will touch frequently as a normal user:

Each of these will be covered in their own subchapters.


Separation of Concerns: Why Files Live Where They Do

The layout is designed to separate different kinds of data. This becomes important for:

Some important distinctions you’ll encounter:

You’ll see this pattern again and again: what something is determines where it lives.


Root vs. User Space

Two “worlds” coexist in the same filesystem tree:

The root user (administrator) has its own home directory, typically /root. This is separate from normal users’ homes in /home and is meant only for administrative work.


Virtual Filesystems: `/proc`, `/sys`, and Friends

Some top-level directories are not stored on disk at all. They are virtual filesystems that expose live system state:

From a user’s perspective, these behave like directories full of files. Under the hood, the kernel dynamically generates their contents when you read them.

This design allows system tools to use standard file operations (open, read, write) for monitoring and configuration.


Mount Points and Extra Storage

Linux has one unified tree, but you can still have multiple disks and partitions. They are integrated via mount points:

Common places where filesystems are mounted:

Conceptually:

Understanding this helps you interpret paths when exploring new systems and documentation.


Filesystem Hierarchy and Permissions

The hierarchy and Linux permissions model are closely related:

You will learn the details of permissions, ownership, and sudo later; for now, know that:

Orientation Tips for Beginners

When you log into a Linux system and open a terminal:

  1. Your current directory is usually your home directory, for example:
    • /home/alex
    • The shorthand for this is ~.
  2. System configuration lives in /etc. If a guide tells you “edit the config file”, it often means a file under /etc.
  3. Installed programs usually live under /usr/bin, but you don’t need to remember exact paths to run them — they are found via the environment PATH.
  4. Logs when “something went wrong” often live under /var/log.
  5. Avoid manually editing or deleting things under:
    • /bin, /sbin, /usr, /lib, /boot, /dev, /proc, /sys
      unless you know exactly what you’re doing.

You will become familiar with the hierarchy naturally through regular use, system updates, and following tutorials.


How This Fits with the Next Chapters

In the subchapters that follow, you will:

This chapter is your mental map of the territory; the next ones will zoom in on each region.

Views: 35

Comments

Please login to add a comment.

Don't have an account? Register now!