Where everything lives

Where everything lives

Linux Filesystem

A deep visual guide to the Linux directory tree, mount points, path resolution, virtual filesystems, and where important system data lives.

Audience
All Linux users
Reading time
24 min
Core directories
18
Unified tree
1
Virtual filesystems
3

The single filesystem tree

Linux presents storage as one directory tree beginning at /. There are no drive letters. Additional disks, partitions, network shares, and virtual filesystems are attached at directories called mount points.

This model makes the system consistent. A USB drive might appear under /media/alex/USB, a server data disk under /srv/data, and a virtual process view under /proc. They are different sources, but all appear as paths.

The single filesystem tree diagram
/
/homepersonal data
/etcconfiguration
/var/loglogs
/usrprogram files
/mntmounted drives

Paths and path resolution

An absolute path starts at /, such as /etc/ssh/sshd_config. A relative path starts from the current working directory, such as ../notes/todo.txt.

The shell expands shortcuts before many commands run. ~ means your home directory. . means the current directory. .. means the parent directory. Hidden files are names beginning with a dot, such as .profile.

Absolute and relative paths
pwd
ls /etc
ls ../shared
ls ~/.config

Top-level directories and what they mean

The top-level directories are not random. They separate user data, system configuration, variable state, installed software, devices, runtime data, temporary files, and virtual kernel views.

Top-level directories and what they mean
DirectoryMeaningExamples
/homeRegular users' personal files and configuration/home/alex/Documents, /home/alex/.config
/etcSystem-wide configuration/etc/ssh/sshd_config, /etc/fstab
/varVariable data that changes over time/var/log, /var/cache, /var/lib
/usrMost user-space programs, libraries, and shared data/usr/bin, /usr/lib, /usr/share
/binEssential user commands, often merged into /usr/bin/bin/sh, /bin/ls
/sbinEssential system administration commands, often merged into /usr/sbin/sbin/ip, /sbin/fsck
/optOptional third-party application bundles/opt/google, /opt/vendor-app
/tmpTemporary files often cleared automatically/tmp/session-data
/devDevice files representing hardware and kernel interfaces/dev/sda, /dev/null
/procVirtual process and kernel information/proc/cpuinfo, /proc/1234
/sysVirtual device and kernel subsystem information/sys/class, /sys/block
/runRuntime state since boot/run/systemd, /run/user/1000
/mntTemporary manual mount points/mnt/backup
/mediaRemovable media mounted for users/media/alex/USB
/rootHome directory for the root user/root/.ssh

Mount points

A mount point is a directory where a filesystem is attached. Before mounting, the directory is just a directory. After mounting, the mounted filesystem's root appears there.

Mounts let Linux place different storage sources at meaningful locations. A web server might store site data on a separate disk mounted at /srv/www. A removable drive might mount under /media.

Mount points diagram
External diskblock device
/mnt/backupattachment point

Virtual filesystems: /proc, /sys, /dev, and /run

/proc and /sys are not normal folders stored on disk. They are kernel-provided views into process, hardware, and kernel state. Reading files there asks the kernel for information.

/dev contains device nodes that programs use to talk to devices through kernel drivers. /run contains runtime state created since the last boot, such as sockets, PID files, and per-user runtime directories.

Examples of real files and what they represent

Examples of real files and what they represent
PathWhat it tells you
/etc/os-releaseDistribution name and version information
/etc/fstabFilesystems the system should mount at boot
/var/logTraditional log file directory
/proc/cpuinfoCPU information from the kernel
/proc/meminfoMemory information from the kernel
/sys/class/netNetwork interfaces exposed through sysfs
/dev/nullA device that discards anything written to it

Where user data, configuration, logs, and runtime data live

User documents normally belong in /home. User-specific app settings usually live under hidden folders such as ~/.config, ~/.local, and ~/.cache. System-wide configuration belongs in /etc. Logs usually live in the systemd journal, /var/log, or application-specific locations under /var.

Runtime files under /run are not permanent. Temporary files under /tmp should not be trusted for long-term storage. Package-managed files under /usr should normally be changed through packages, not hand-edited.