Linux Filesystem Hierarchy Explained

Tested on RHEL 10.2 (Coughlan)
Package bash 5.2.26-6.el10
coreutils 9.5-8.el10_2
findutils 4.10.0-5.el10
man-db 2.12.0-10.el10
Applies to Ubuntu, Debian, Kali Linux, Linux Mint, Pop!_OS, Raspberry Pi OS, elementary OS, Zorin OS, Parrot OS, MX Linux, RHEL, Rocky Linux, AlmaLinux, Oracle Linux, CentOS Stream, Fedora, Arch Linux
Privilege Normal user for most navigation; root for /root and some /var paths
Scope Major Linux directories, what they store, absolute versus relative paths, and practical navigation with pwd, cd, ls, file, stat, readlink, and basic search tools. Does not cover partitioning, filesystem formatting, LVM, or mount management.
Related guides Linux command line
Linux file management
find command
Linux boot process
RHCSA tutorial

Every file path on Linux hangs from a single tree that starts at /. Knowing which top-level directories hold configuration, logs, programs, and user data saves you from guessing—and from editing the wrong file. This guide maps the directories you actually touch, then shows how to move between them and inspect what you find. For shell syntax and quoting depth, continue with the Linux command line lesson in the RHCSA tutorial syllabus.

IMPORTANT
This article explains directory layout and navigation. It does not cover disk partitions, creating filesystems, persistent mounts, or LVM—that belongs in storage and mounting guides.

What Is the Linux Filesystem Hierarchy?

Linux presents one directory tree rooted at /. Whether data lives on one disk or many, users and programs navigate a single hierarchy of directories and files.

A few ideas that confuse beginners early:

  • Directories versus mounted filesystems/home might be a directory on your root disk or a separate filesystem mounted at that path. ls and cd always use the path; mount and findmnt tell you which filesystem or source is mounted at that path.
  • / versus the root user/ is the top directory. The root account is a username whose home directory is /root, not /.
  • Files and devices in one tree — Block devices appear as paths such as /dev/sda, and kernel interfaces appear under /proc and /sys even though they are not ordinary disk files.

Distributions follow the Filesystem Hierarchy Standard (FHS) conventions loosely. You do not need to memorize every obscure path from the specification—learn the major directories administrators use daily, then drill into subdirectories when a task requires them.


Linux Directory Structure Quick Reference

Directory Common purpose
/ Top of the filesystem hierarchy
/etc System and application configuration
/home Normal user home directories
/root Root user's home directory
/var Variable data such as logs, caches, and application state
/usr Installed programs, libraries, and shared data
/tmp Temporary files
/boot Kernel and bootloader-related files
/dev Device nodes
/proc Process and kernel information
/sys Kernel and device information exposed through sysfs
/run Runtime state since boot
/opt Optional or add-on software
/srv Data provided by system services
/mnt Temporary or manual mounts
/media Removable-media mounts where used

Understand the Root Directory /

/ is the anchor for every absolute path. List its immediate children to see how the distribution lays out the tree:

bash
ls -l /
output
dr-xr-xr-x.   2 root root    6 Apr  2  2025 afs
lrwxrwxrwx.   1 root root    7 Apr  2  2025 bin -> usr/bin
dr-xr-xr-x.   5 root root 4096 Aug  3 11:43 boot
drwxr-xr-x.  20 root root 3420 Aug  7 22:42 dev
drwxr-xr-x. 138 root root 8192 Aug  7 22:43 etc
drwxr-xr-x.   5 root root   54 Aug  7 22:30 home
lrwxrwxrwx.   1 root root    7 Apr  2  2025 lib -> usr/lib
...
dr-xr-x---.   9 root root 4096 Aug  7 22:12 root
drwxr-xr-x.  12 root root  144 Aug  3 11:33 usr

The l at the start of a ls -l line marks a symbolic linkbin points into /usr/bin on this system. Real directories show d in the first column.

stat confirms that / itself is a directory owned by root:

bash
stat /
output
File: /
  Size: 235       	Blocks: 0          IO Block: 4096   directory
Device: 253,0	Inode: 128         Links: 18
Access: (0555/dr-xr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)

Do not confuse / with /root. The latter is only the root account's home—compare paths when tasks mention "the root directory" versus "log in as root."


Configuration Files in /etc

/etc holds static configuration read by services and tools at startup or when reloaded. Formats differ per application; this section maps locations only.

Common examples on a running server:

Path Typical role
/etc/hosts Static hostname-to-address mappings
/etc/fstab Filesystems to mount at boot
/etc/passwd User account metadata (not passwords)
/etc/ssh/ OpenSSH client and server configuration
/etc/systemd/ systemd unit files and drop-in directories

Applications often use directories under /etc, not a single file:

bash
ls -d /etc/ssh /etc/systemd
output
/etc/ssh
/etc/systemd

List a few representative files:

bash
ls -la /etc/hosts /etc/fstab /etc/passwd
output
-rw-r--r--. 1 root root  615 Aug  5 19:01 /etc/fstab
-rw-r--r--. 1 root root  454 Aug  7 21:57 /etc/hosts
-rw-r--r--. 1 root root 2459 Aug  7 22:30 /etc/passwd

Editing /etc usually needs elevated privileges. Validate syntax with the tool's test mode (sshd -t, apachectl configtest) before you restart a service.


Variable Data in /var

/var stores data that changes while the system runs—logs, package caches, application databases, mail queues, and spools.

Subdirectory Typical contents
/var/log Log files (messages, secure, service-specific logs)
/var/lib Application state (RPM databases, container metadata, service data)
/var/cache Reusable cached data (package metadata, font caches)
/var/tmp Temporary files that may survive reboot
/var/spool Queued work (mail, print jobs, cron output)

A few names from a live system illustrate the variety:

bash
ls /var/log | head -8
output
audit
boot.log
boot.log-20260805
btmp
chrony
cron
cups
dnf.librepo.log
bash
ls /var/lib | head -8
output
AccountsService
alsa
alternatives
authselect
bluetooth
brltty
chrony
cni

When disk use grows unexpectedly, /var/log and /var/cache are common places to inspect before you chase application bugs.


Programs and Shared Data Under /usr

/usr is the main hierarchy for installed programs, libraries, and static shared data. In FHS terms it is designed so it can be mounted read-only during normal operation; package installation and system maintenance still modify it. Separating /usr from / historically let administrators mount a shared /usr across many hosts; today it still groups user-facing software away from configuration in /etc and variable data in /var.

Path Role
/usr/bin User commands (ls, grep, editors)
/usr/sbin System administration binaries (sshd, fdisk)
/usr/lib / /usr/lib64 Shared libraries and architecture-specific modules
/usr/share Architecture-independent data (docs, icons, man pages, locale files)
/usr/local Software installed locally by the administrator, outside distribution packages

This RHEL host keeps thousands of user commands under /usr/bin and hundreds of admin tools under /usr/sbin:

bash
ls /usr/bin | wc -l
output
1459
bash
ls /usr/sbin | wc -l
output
526

/usr/local is intentionally empty or sparse on fresh installs—use it when you compile software or install tarballs outside dnf:

bash
ls -ld /usr/local/bin
output
drwxr-xr-x. 2 root root 56 Aug  5 11:44 /usr/local/bin

User Data in /home and /root

Normal user accounts receive home directories under /home:

bash
ls -la /home
output
drwx------.  3 demo1        demo1          78 Aug  7 22:06 demo1
drwx------. 14 golinuxcloud golinuxcloud 4096 Aug  3 11:55 golinuxcloud
drwx------.  5 student      student       106 Aug  7 22:42 student

Each home holds documents, shell history, and hidden configuration files whose names start with a dot:

bash
ls -la /home/student/.bashrc
output
-rw-r--r--. 1 student student 522 Oct 29  2024 /home/student/.bashrc

The root account's home is /root, not /:

bash
ls -la /root | head -5
output
dr-xr-x---.  9 root root    4096 Aug  7 22:12 .
-rw-r--r--.  1 root root 4647231 Aug  3 11:50 anaconda-tb-j5uq4yhy
-rw-------.  1 root root     100 Aug  3 11:57 .bash_history

The shell expands ~ to your home directory ($HOME). cd with no arguments also returns home in bash.


System Interfaces Under /dev, /proc, and /sys

These paths look like directories in ls, but much of what they contain is kernel-provided, not ordinary files you edit with an editor.

/dev — device nodes

Block and character devices appear as special files:

bash
ls -l /dev/sda /dev/null /dev/tty
output
crw-rw-rw-. 1 root root 1, 3 Aug  7 22:42 /dev/null
brw-rw----. 1 root disk 8, 0 Aug  7 22:42 /dev/sda
crw-rw-rw-. 1 root tty  5, 0 Aug  7 22:42 /dev/tty

/dev/sda is a block device for the first SCSI/SATA disk. /dev/null discards writes. /dev/tty is the controlling terminal.

/proc — process and kernel tables

/proc is a virtual filesystem exposing live kernel data:

bash
head -3 /proc/cpuinfo
output
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
bash
head -3 /proc/meminfo
output
MemTotal:        6214620 kB
MemFree:         3942832 kB
MemAvailable:    4716816 kB

Each running process has a numbered directory:

bash
ls /proc/self | head -10
output
arch_status
attr
autogroup
auxv
cgroup
cmdline
comm
coredump_filter
cpu_resctrl_groups

/proc/self is a symlink to the process that issued the ls command.

/sys — sysfs device layout

/sys exposes kernel objects in a structured tree—useful for block device names and driver attributes:

bash
ls /sys/class/block
output
dm-0
dm-1
sda
sda1
sda2
sda3
sdb
sr0

Treat /proc and /sys as read-mostly interfaces. You query them with cat, grep, and tools such as lscpu; you do not format or mount them like /dev/sda1.


Boot Files Under /boot

/boot holds the kernel image, initramfs archives, and bootloader configuration consumed before the main system is fully online:

bash
ls /boot | head -8
output
config-6.12.0-211.42.1.el10_2.x86_64
efi
grub2
initramfs-6.12.0-211.42.1.el10_2.x86_64.img
initramfs-0-rescue-23b7a5ba4a464d768c37c2b2990e7d06.img
loader
vmlinuz-6.12.0-211.42.1.el10_2.x86_64

On this host /boot is a separate XFS filesystem mounted at /boot. For the full firmware-to-login chain, see Linux boot process explained and GRUB2 on RHEL.


Temporary and Runtime Data

Three paths sound interchangeable but serve different lifetimes:

Path Typical use Persistence
/tmp Short-lived scratch space for users and programs Often cleared on reboot
/var/tmp Longer temporary files Survives reboot
/run PID files, sockets, runtime locks since boot Cleared on reboot
bash
ls -ld /tmp /var/tmp /run
output
drwxr-xr-x. 47 root root 1240 Aug  7 22:42 /run
drwxrwxrwt. 25 root root 4096 Aug  7 22:52 /tmp
drwxrwxrwt. 12 root root 4096 Aug  7 22:50 /var/tmp

The t in /tmp permissions marks the sticky bit—users can create files but cannot delete each other's entries in that directory.

/opt and /srv appear less often on minimal servers but matter when add-on products install under /opt or when service data is published from /srv. /mnt and /media are conventional mount points for administrator mounts and removable media.


Absolute vs Relative Paths

An absolute path starts at / and does not depend on your current directory:

text
/etc/ssh/sshd_config

A relative path starts from your current working directory:

text
sshd_config
../logs
./script.sh

Common symbols:

Symbol Meaning
/ Root of the tree
. Current directory
.. Parent directory
~ Your home directory (shell expansion)
trailing / Directory path (optional but clarifies intent)

Examples mixing styles:

text
~/Documents/report.txt
../../etc/hosts

The Linux command line lesson expands quoting, tilde expansion, and tab completion—this page focuses on where paths point in the hierarchy.


Start by printing where you are:

bash
pwd
output
/root/golinuxcloud-static

Move with an absolute path:

bash
cd /etc/ssh
bash
pwd
output
/etc/ssh

Step up with a relative path:

bash
cd ..
bash
pwd
output
/etc

Return home:

bash
cd ~
bash
pwd
output
/root

cd - jumps back to the previous working directory—handy when you alternate between config and logs.

List entries, including hidden dotfiles:

bash
ls -la /etc/ssh | head -6
output
drwxr-xr-x.   2 root root  4096 Aug  3 12:00 .
drwxr-xr-x. 138 root root  8192 Aug  7 22:43 ..
-rw-r--r--.   1 root root  3656 Aug  3 12:00 sshd_config

ls -l adds permissions, owner, and size. ls -a forces hidden names to appear—critical when you look for ~/.ssh or dotfiles in a home directory.


Inspect Files and Directories

After you arrive at a path, inspect what it is before you edit or execute.

file guesses the content type:

bash
file /etc/ssh/sshd_config
output
/etc/ssh/sshd_config: ASCII text

stat reports inode metadata—type, permissions, owner, timestamps:

bash
stat -c '%F %a %U %G %n' /etc/ssh/sshd_config
output
regular file 600 root root /etc/ssh/sshd_config

readlink -f resolves symlinks to a canonical absolute path:

bash
readlink -f /etc/ssh/sshd_config
output
/etc/ssh/sshd_config

When a path is a symlink, ls -l shows the arrow target; readlink prints the destination directly.


Find Where Linux Stores Something

Use the right lookup tool for the question:

Question Tool
Which executable runs? type, command -v, whereis
Which package owns a file? rpm -qf (RPM systems) or dnf provides
Where is a file by name? find (see find command)
Where is package documentation? ls /usr/share/doc/pkg*

Resolve the sshd binary:

bash
type sshd
output
sshd is /usr/sbin/sshd
bash
whereis sshd
output
sshd: /usr/sbin/sshd /usr/share/man/man8/sshd.8.gz

Find a configuration file by name under /etc:

bash
find /etc -maxdepth 2 -name 'sshd_config' 2>/dev/null
output
/etc/ssh/sshd_config

Identify the owning RPM package:

bash
rpm -qf /usr/sbin/sshd
output
openssh-server-9.9p1-25.el10_2.x86_64

List shipped documentation:

bash
ls /usr/share/doc/openssh* | head -5
output
ChangeLog
CREDITS
OVERVIEW
PROTOCOL
PROTOCOL.agent

For deep find expressions and permission-aware searches, use the dedicated find guide rather than duplicating every flag here.


Common Filesystem Navigation Mistakes

Mistake What goes wrong Safer habit
Confusing / and /root Editing or deleting under the wrong tree Say "root directory /" versus "root's home /root"
Omitting leading / Relative path resolves from an unexpected cwd Use absolute paths in scripts and when tired
Assuming cwd in relative paths ../etc may not reach /etc pwd before relative hops
Forgetting hidden files ls hides dotfiles ls -a or ls -la in home and /etc
Permission denied on cd A parent directory lacks execute permission ls -ld and namei -l; use an authorized account or root shell, or correct directory permissions when appropriate
Following symlinks blindly You land outside the directory you thought ls -l and readlink -f before destructive commands
Treating /dev/sda as a normal file cat /dev/sda dumps raw binary data and is not a useful way to inspect a disk Use lsblk, blkid, or file -s; never redirect or write data to the device unless intentional

Practical Walkthrough: sshd on a Real System

Tracing one service ties the hierarchy together without turning this into a certification lab.

Executable — the server binary lives in /usr/sbin:

bash
type sshd
output
sshd is /usr/sbin/sshd

Configuration — settings live under /etc/ssh/:

bash
ls -l /etc/ssh/sshd_config
output
-rw-------. 1 root root 3656 Aug  3 12:00 /etc/ssh/sshd_config

Logs — authentication events on RHEL often land in /var/log/secure:

bash
find /var/log -maxdepth 1 -name 'secure*'
output
/var/log/secure

Documentation — package docs under /usr/share/doc:

bash
ls -d /usr/share/doc/openssh 2>/dev/null
output
/usr/share/doc/openssh

Runtime process — live state under /proc and SELinux context from ps:

bash
ps -efZ | grep '[s]shd' | head -2
output
system_u:system_r:sshd_t:s0-s0:c0.c1023 root 1193      1  0 22:42 ?        00:00:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 startups
system_u:system_r:sshd_session_t:s0-s0:c0.c1023 root 2218 1193  0 22:43 ?  00:00:00 sshd-session: root [priv]

The listener line shows the process type sshd_t—useful when SELinux blocks a service. Process directories under /proc/1193/ expose cmdline, limits, and file descriptors for that PID.


References


Summary

Linux organizes everything under a single tree starting at /. Configuration concentrates in /etc, changing runtime data in /var, programs and shared static content in /usr, and personal files in /home or /root. Virtual interfaces under /dev, /proc, and /sys expose devices and kernel state through paths that behave like files even when nothing is stored on disk like a normal document.

Absolute paths always begin with /; relative paths depend on your current working directory and symbols such as ., .., and ~. pwd, cd, and ls move and list; file, stat, and readlink tell you what a path actually is before you edit it. type, whereis, rpm -qf, and find answer where binaries, configs, logs, and documentation live—patterns you reuse on every service you administer.

Next, practice copy, move, and delete workflows in Linux file management, or return to the RHCSA tutorial syllabus. Storage layout, mounts, and LVM belong in dedicated guides—not in this hierarchy map.


Frequently Asked Questions

1. What is the difference between / and /root on Linux?

The forward slash / is the root of the entire directory tree—the top directory every other path builds on. /root is the home directory for the root user account, a normal directory path under / just like /home/student is for the student user.

2. Are /proc and /sys real directories on disk?

They are mount points for virtual kernel interfaces. Files under /proc and /sys reflect live kernel and device state; they are not ordinary files stored on your root filesystem the way /etc/passwd is.

3. Should I edit /etc/resolv.conf directly for DNS on RHEL?

On NetworkManager-managed systems, DNS settings usually come from connection profiles. Editing /etc/resolv.conf by hand may not persist. Set ipv4.dns on the nmcli profile and activate the connection instead.

4. How do I find where a command or config file lives?

Use type or command -v for shell resolution, whereis for common binary and man paths, rpm -qf for the package owning a file, and find when you need to search by name under a directory tree.

5. What is the difference between /tmp and /var/tmp?

/tmp is world-writable temporary space often cleared on reboot. /var/tmp survives reboots and is meant for longer-lived temporary files. /run holds runtime state for the current boot and is managed by systemd and services.
Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with more than 15 years of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive experience, he excels across development, DevOps, networking, and security, delivering robust and efficient solutions for diverse projects.

  • Go (programming language)
  • Python (programming language)
  • DevOps
  • Computer Security
  • Cloud Computing
  • Kubernetes
  • Linux
  • Ansible (software)