Linux Filesystem Hierarchy
A cheatsheet for common directories and their purposes in a Linux system.
/
The root directory, the starting point of the filesystem hierarchy.
/bin
Essential command binaries for all users (e.g., ls, cp, mv).
/boot
Boot loader files, such as the kernel and initrd.
/dev
Device files, representing hardware components.
/etc
Host-specific system configuration files.
/etc/apt - Configuration files for package management. /etc/network - Network configuration files. (Critical for network setup)/etc/ssh - SSH configuration files. (Important for remote access)/etc/systemd - Systemd service configuration files. (Essential for system services)/home
User home directories.
~/ - Each user’s home directory (e.g., /home/username). ~/.bashrc - Configuration for the Bash shell. Modified to set aliases or change the prompt. ~/.profile - Personal startup script for login shells. Modified to set environment variables like PATH. ~/.config - Directory for user-specific application configuration files. (A common standard (XDG Base Directory Specification))/lib
Essential shared libraries needed by the binaries in /bin and /sbin.
/media
Mount point for removable media, such as USB drives.
/mnt
Temporarily mounted filesystems.
/opt
Optional add-on application software packages.
/proc
Virtual filesystem providing process and kernel information.
/root
Home directory for the root user.
/sbin
Essential system binaries, usually used by the system administrator.
/srv
Site-specific data served by the system.
/tmp
Temporary files. Files in this directory are often deleted during shutdown.
/usr
Secondary hierarchy for read-only user data.
/usr/bin - User binaries. (Contains most user commands)/usr/lib - Libraries for binaries in /usr/bin. (Essential for software execution)/usr/local - Locally installed software. (Custom software not managed by the package manager)/var
Variable data files, such as logs and databases.
/var/lib - Caches, databases, application state. (Data managed by a program that must survive reboots and updates.)/var/run - Ephemeral runtime data (Data that is not persistent across reboots.)/var/log - Log files. (Important for system monitoring)/var/www - Web server files. (Commonly used for web hosting)Note: The "/" directory is the root of the filesystem, containing all other directories.