LINUX / A CONCEPT NOTE

Filesystem Hierarchy

why /var, /etc, /opt exist

~60 sec read

Overview · mechanism
pitfall · examples

01 / THE SHORT VERSION

The idea in a few sentences.

Linux strictly structures directories: /etc for static configuration files, /var for variable data (logs, caches), /bin for user binaries, and /opt for third-party software packages.

02 / FOLLOW THE MECHANISM

How filesystem lookups flow

  1. Root

    all file lookups start at the single root directory (/).

  2. /etc

    services read static configurations (like hostnames, networks) here during startup.

  3. /var

    services write operational logs and state data continuously.

  4. /usr/bin

    system executes core user CLI tools and packages.

04 / COMMAND NOTES

Read the command, then the result.

Inspect the flags and arguments before trying an example. Snippets can need local setup, replacement values, or resources in your own environment.

EXAMPLE 01 · REFERENCE

check free space on all mounted filesystems

df -h

EXAMPLE 02 · REFERENCE

measure directory space usage

du -sh /var/log/*

Explore command anatomy in the CLI lab