>
The Linux file system follows a standardized hierarchy defined by the Filesystem Hierarchy Standard (FHS). Understanding this structure is crucial for system administration, troubleshooting, and effective Linux usage. Every directory serves a specific purpose, and knowing which files live where makes you a more confident Linux operator.
The Linux file system hierarchy is a standardized directory structure that organizes system files, user files, and configuration data. Unlike Windows, which uses drive letters (C:, D:), Linux uses a single root directory (/) from which all other directories branch. This unified approach creates a consistent, predictable layout across all Linux distributions.
The FHS standard ensures that applications, users, and administrators know exactly where to find or place files. When you understand this hierarchy, navigating any Linux system becomes intuitive, and you'll waste less time hunting for configuration files or binaries.
Everything in Linux starts with the root directory (/). This isn't a user's home folder—it's the filesystem root that contains all other directories and files. When you boot into Linux, the kernel mounts the root filesystem, and from there, other filesystems (like /home or /var) can be mounted.
Here's what you'll find when you run ls / on most Linux systems:
| Directory | Purpose |
|---|---|
/bin |
Essential command binaries (ls, grep, cat) |
/sbin |
System binaries for root only (fsck, reboot) |
/boot |
Bootloader and kernel files |
/dev |
Device files (hard drives, terminals) |
/etc |
Configuration files for system and apps |
/home |
User home directories |
/lib |
Essential shared libraries and modules |
/media |
Mount points for removable media |
/mnt |
Temporary mount points for filesystems |
/opt |
Optional software packages |
/proc |
Virtual filesystem with system process info |
/root |
Root user's home directory |
/run |
Runtime data for running processes |
/srv |
Data for services provided by system |
/sys |
Virtual filesystem with kernel/hardware info |
/tmp |
Temporary files (cleared on reboot) |
/usr |
User programs, libraries, documentation |
/var |
Variable data (logs, caches, mail) |
/bin contains critical command binaries that must be available even in single-user mode. Think of these as your toolkit: ls, grep, cat, cp, mv, and bash itself. These commands are needed for basic system operation and repair.
/sbin (system binaries) contains programs that typically require root privileges. This includes fsck (filesystem checker), reboot, shutdown, ifconfig, and iptables. Regular users can still see what's here, but they can't execute these programs without elevated permissions.
In modern systems like Ubuntu or Fedora, /bin, /sbin, /lib, and /lib64 are often symlinked to their counterparts in /usr for simplicity. But you'll still interact with them as if they're separate directories.
/etc is where system and application configuration files live. This directory is the nerve center of Linux administration. You'll spend considerable time here editing files with vim or nano.
Common files you'll encounter:
/etc/passwd — User account information/etc/shadow — Encrypted user passwords (root-only readable)/etc/sudoers — Sudo privilege configuration/etc/hostname — System hostname/etc/hosts — Static hostname-to-IP mappings/etc/fstab — Filesystem mount configuration/etc/ssh/sshd_config — SSH daemon settings/etc/nginx/ or /etc/apache2/ — Web server configsWhen you install a service or application, its configuration file usually lands in /etc or a subdirectory like /etc/nginx or /etc/mysql.
/home is where regular user accounts store their personal files. Each user gets a directory: /home/alice, /home/bob, and so on. Inside each home directory, you'll find personal files, configurations, and the hidden .bashrc and .ssh directories.
/root is the home directory for the root (administrator) user. It's separate from /home because root needs a home directory accessible even if /home isn't mounted.
When you log in, your shell sets the $HOME environment variable to your home directory. The tilde (~) is shorthand for your home directory:
cd ~
# Equivalent to:
cd /home/yourusername
/var stores data that changes frequently during normal operation. This includes:
/var/log/ — System and application logs/var/cache/ — Cached data from applications/var/mail/ — User mailboxes/var/spool/ — Print queues and scheduled job data/var/tmp/ — Temporary files (not cleared on reboot)/var/run/ — Runtime data (now often a symlink to /run)When troubleshooting, /var/log is your first stop. System logs live in /var/log/syslog (Debian/Ubuntu) or /var/log/messages (RedHat/CentOS), and application-specific logs appear in subdirectories like /var/log/nginx or /var/log/mysql.
/usr contains most user-installed applications and their libraries. The name is historical and misleading—it doesn't mean "user" files, but rather "Unix System Resources." This is a major directory with several important subdirectories:
/usr/bin — Non-essential command binaries (Python, Node.js, custom apps)/usr/sbin — Non-essential system binaries/usr/lib — Libraries for programs in /usr/bin/usr/local/ — Software compiled locally or installed manually/usr/share — Shared data (documentation, icons, man pages)When you install Python via your package manager, it goes to /usr/bin/python. When you compile something from source and run make install, it typically lands in /usr/local/bin. This separation prevents locally-compiled software from overwriting system packages.
/opt is for third-party software that doesn't follow standard Unix conventions. Large commercial applications or custom software bundles often install here. For example, you might find /opt/firefox or /opt/myapp/.
/srv holds data for services provided by the system. A web server might store website files in /srv/www, or a FTP server might use /srv/ftp. This keeps service data separate from user data.
/boot contains everything needed to boot your system: the bootloader (GRUB) configuration, the Linux kernel, and initrd (initial ramdisk) images. You'll typically see files like vmlinuz-5.15.0 (the kernel) and initrd.img-5.15.0 (the initial ramdisk).
This directory must be accessible before the main filesystem is mounted, which is why it's often on a separate partition. When upgrading your kernel, /boot is where new kernel files land.
/dev contains device files that represent hardware devices and pseudo-devices. These aren't regular files—they're special files that act as interfaces to drivers.
Common device files:
/dev/sda, /dev/sdb — SATA/SSD drives/dev/sda1, /dev/sda2 — Partitions on drives/dev/nvme0n1 — NVMe drives/dev/tty — Terminal devices