- Home
-
Linux Filesystem
Linux Filesystem Structure Cheatsheet
Comprehensive reference for Linux filesystem hierarchy covering essential system directories, user directories, runtime data, and mount points. Understand the purpose and contents of every major directory in a Linux system.
Free account required
Linux Filesystem Hierarchy
In Linux and Unix-like systems, everything is organized in a hierarchical directory structure starting from the root directory (/
).
Each directory has a specific purpose defined by the Filesystem Hierarchy Standard (FHS). Understanding this structure is essential for system administration, troubleshooting, and navigating VPS servers effectively.
Related Resources:
Table of Contents
Essential System Directories
Core system directories required for basic system operation and configuration.
Binary Executables
Stores system binaries (executables) essential for system operation. Contains fundamental commands needed by all users.
Common binaries:
ls, cat, cp, mv, rm, bash, sh, pwd, mkdir, chmod
Boot Loader Files
Stores boot files required for system startup, including the Linux kernel, initrd images, and bootloader configuration. Learn more about the complete Linux boot process.
Key files:
vmlinuz-* (kernel), initrd.img-* (initial RAM disk), grub/ (bootloader)
Device Files
Stores device files representing hardware components and pseudo-devices. Everything in Linux is treated as a file, including hardware.
Examples:
/dev/sda (hard disk), /dev/tty (terminal), /dev/null, /dev/random
Configuration Files
System's core configuration files. Contains system-wide configuration files and scripts for services, network, and system behavior. Proper security configuration is crucial for server hardening.
Important files/dirs:
/etc/passwd, /etc/hosts, /etc/fstab, /etc/nginx/, /etc/ssh/
System Libraries
Libraries and kernel modules essential for binaries in /bin and /sbin. Shared libraries (.so files) required by system programs.
Contents:
/lib/modules/ (kernel modules), /lib/x86_64-linux-gnu/ (libraries)
System Binaries
Stores super user binaries (root-only). Essential system administration commands and tools for system maintenance.
Common commands:
fsck, fdisk, mkfs, reboot, shutdown, ifconfig, iptables
User & Application Directories
Directories containing user data, home directories, and installed applications.
User Home Directories
Stores user personal data and configuration files. Each user has a subdirectory here for their personal files, documents, and settings. Understanding file permissions is crucial for managing home directories securely.
Structure:
/home/username/Documents, /home/username/.bashrc, /home/username/.config/
Root User's Home
Root user's home directory. Separate from /home for security reasons. Contains root user's personal files and configuration.
Access:
Only accessible by root user (requires sudo or root privileges)
User Programs & Data
Stores user binaries and program data. Contains the majority of user utilities, applications, libraries, and documentation.
Important subdirectories:
/usr/bin (user commands), /usr/lib (libraries), /usr/local (locally installed software)
Optional Software
Store optional software packages and third-party applications. Typically used for manually installed or proprietary software.
Usage:
/opt/google/chrome, /opt/lampp, /opt/my-application
Runtime & Variable Data
Directories for temporary data, logs, and runtime system information.
Runtime Data
Stores system runtime data since last boot. Contains PID files, socket files, and other runtime information. Cleared on reboot.
Contents:
/run/systemd/, /run/lock/, /run/user/ (per-user runtime directories)
Temporary Files
Stores temporary files created by applications and users. Files may be automatically deleted on reboot or after a certain period.
Note:
World-writable directory (sticky bit set). Any user can create files.
Variable Data Files
Stores variable data files that change during system operation, including logs, databases, cache, and spool files. Master log parsing techniques for effective troubleshooting.
Important subdirectories:
/var/log/ (system logs), /var/cache/ (cache data), /var/www/ (web content)
Process Information
Stores processes and kernel parameters (virtual filesystem). Provides interface to kernel data structures. Each running process has a numbered directory. Learn more about process management.
Examples:
/proc/cpuinfo, /proc/meminfo, /proc/[PID]/, /proc/sys/
Mount Points & Recovery
Directories for mounting external filesystems and recovering lost files.
Removable Media
Mount point for removable media devices. Modern systems automatically mount USB drives, CDs, and DVDs here.
Typical usage:
/media/username/USB_DRIVE, /media/cdrom
Mount Directory
Mount directory for devices and filesystem. Used for temporarily mounting filesystems manually by administrators.
Usage:
mount /dev/sdb1 /mnt/external # Manual mount point
Recovery Directory
Recover damaged or lost files. Used by fsck (filesystem check) to place recovered file fragments after system crashes.
Purpose:
Each ext filesystem partition has its own lost+found directory
Service Data
Stores service data provided by the system. Contains data for services like web servers, FTP servers, and other system services.
Example structure:
/srv/www/ (web data), /srv/ftp/ (FTP data), /srv/git/ (git repositories)
Quick Navigation Commands
Essential commands for navigating the filesystem. Explore more server management tools for comprehensive system monitoring.
cd / # Go to root directory
ls -la / # List all files in root
tree -L 1 / # Tree view of root
df -h # Show disk usage
du -sh /* # Size of each directory
man hier # Filesystem hierarchy manual
Related Cheatsheets
Expand your Linux knowledge with these related guides
Essential Linux Commands
Master fundamental commands for file management, system info, and more.
Linux File Permissions
Understand chmod, chown, and permission management in depth.
Linux Administration Tips
Pro tips and best practices for effective system administration.
Linux Boot Process
Deep dive into system initialization from BIOS to login.
Linux Log Parsing
Techniques for analyzing and troubleshooting system logs.
Linux Process Management
Control and monitor processes with ps, top, kill, and more.
Ready to Benchmark Your VPS?
Compare performance across different VPS providers. Run comprehensive benchmarks and find the best server for your needs.