Linux Filesystem Hierarchy (FHS)

Think of Linux like a house. Each directory is a room with a specific purpose.

Root directory: /

Everything starts here. It’s the top of the tree.

/bin — Basic Programs

Contains the essential commands you use every day. Examples:

  • ls, cp, mv, rm, cat

/sbin — System Programs

System/administration tools (usually for root). Examples:

  • fsck, iptables, mount

/usr — User Programs (Most Software)

This is like “Program Files.” Contains most apps, libraries, documentation. Inside it:

  • /usr/bin → most user commands

  • /usr/sbin → more system tools

  • /usr/lib → libraries

/var — Variable Data

Changes often. Log files, databases, package files. Examples:

  • /var/log → system logs

  • /var/cache

  • /var/spool

/etc — Configuration Files

System-wide settings for programs and services. Examples:

  • /etc/passwd

  • /etc/fstab

  • /etc/ssh/

/home — Your Personal Files

Each user gets a folder here. Examples:

  • /home/alex/Documents/…

/root — Root’s Home Folder

Like /home, but only for the superuser.

/lib and /lib64 — Libraries for Programs

Like DLLs in Windows. Programs in /bin and /sbin use them.

/tmp — Temporary Files

Temporary storage. Safe to delete. Cleared on reboot.

/opt — Optional Software

Third-party apps you install manually go here.

/media — External Devices

USB drives, external disks, etc., get mounted here.

/mnt — Manual Mount Point

You mount drives manually here when needed.

/dev — Devices as Files

Linux treats hardware like files. Examples:

  • /dev/sda → your disk

  • /dev/tty → terminal

  • /dev/null → “black hole”

/proc — Kernel & Process Info

Not real files. They show system information. Examples:

  • /proc/cpuinfo

  • /proc/meminfo

  • /proc/1234/ → info about process 1234

/sys — System Hardware Info

Another virtual filesystem showing hardware details.

Summary Table

Directory
Purpose

/

Root of all files

/bin

Basic user commands

/sbin

System admin commands

/usr

Installed software & libraries

/var

Changing data (logs, caches)

/etc

Config files

/home

User personal files

/root

Root user’s home

/tmp

Temporary files

/opt

Optional third-party software

/media

Mounted external devices

/mnt

Manual mount directory

/dev

Hardware as files

/proc

System & process info

/sys

Hardware & kernel info

Last updated