Directory Layout
Directory Structure Overview
/
├── bin → Essential user commands
├── boot → Boot files
├── dev → Device files
├── etc → System configuration
├── home → User home directories
├── lib → System library files
├── media → Auto-mount points
├── mnt → Manual mount points
├── opt → Third-party software
├── proc → Process information (virtual)
├── root → Root user home directory
├── run → Runtime data
├── sbin → System administration commands
├── srv → Service data
├── sys → Kernel device information (virtual)
├── tmp → Temporary files
├── usr → User-level programs and data
└── var → Variable dataDetailed Descriptions
/etc — System Configuration Files
Stores configuration files for almost all system services.
/etc/
├── apt/ # APT package manager configuration
│ └── sources.list.d/ # Software source configuration
├── default/grub # GRUB bootloader configuration
├── fstab # Disk mount configuration
├── hostname # Hostname
├── hosts # Local DNS mapping
├── NetworkManager/ # Network management configuration
├── nginx/ # Nginx configuration (if installed)
├── passwd # User account information
├── shadow # User passwords (encrypted)
├── ssh/ # SSH server configuration
├── sudoers # sudo permissions configuration
├── systemd/ # systemd configuration overrides
└── environment # Global environment variables/var — Variable Data
Stores data that changes during runtime.
/var/
├── cache/apt/archives/ # APT download cache
├── lib/ # Program runtime data
│ ├── dpkg/ # dpkg package database
│ └── snapd/ # Snap data
├── log/ # System logs
│ ├── syslog # System log
│ ├── auth.log # Authentication log
│ └── kern.log # Kernel log
├── mail/ # Mail
├── spool/cron/ # Cron jobs
└── www/html/ # Default web directory/home — User Home Directories
Each regular user has a /home/username directory.
/home/user/
├── .bashrc # Bash configuration
├── .config/ # User-level application configuration (XDG)
├── .local/ # User-level data and programs
│ ├── bin/ # User-level executables
│ └── share/ # User-level data
├── .ssh/ # SSH keys and configuration
├── Desktop/ # Desktop
├── Documents/ # Documents
├── Downloads/ # Downloads
└── snap/ # Snap user data/usr — User-level Programs
Programs and library files installed by the system. Read-only directory.
/usr/
├── bin/ # User commands (ls, cp, vim, etc.)
├── sbin/ # System administration commands
├── lib/ # Library files
├── lib64/ # 64-bit library files
├── include/ # C/C++ header files
├── share/ # Architecture-independent data
│ ├── applications/ # .desktop files
│ ├── doc/ # Documentation
│ ├── fonts/ # Fonts
│ └── man/ # Man pages
└── local/ # Locally compiled programs
├── bin/
├── lib/
└── share//opt — Third-party Software
Independently installed third-party commercial or large software packages.
/opt/
├── google/chrome/ # Google Chrome
├── visual-studio-code/ # VS Code (when not installed as Snap)
└── .../tmp — Temporary Files
Readable and writable by all users. Usually cleared on system reboot.
# Check /tmp usage
du -sh /tmp
# Permissions: drwxrwxrwt (sticky bit)
# Anyone can write, but only the owner can delete their own files/boot — Boot Files
/boot/
├── vmlinuz-* # Linux kernel
├── initrd.img-* # Initial RAM disk
├── config-* # Kernel configuration
├── grub/ # GRUB bootloader
│ └── grub.cfg # GRUB configuration (auto-generated)
└── efi/ # EFI partition mount point
└── EFI/
├── ubuntu/ # Ubuntu boot files
└── BOOT/ # Default boot files/dev — Device Files
/dev/
├── sda, sdb... # SATA/SCSI hard drives
├── nvme0n1 # NVMe hard drive
├── tty* # Terminal devices
├── video0 # Webcam
├── null # Null device (discards output)
├── zero # Zero device (produces zero bytes)
├── random, urandom # Random number generators
└── loop* # Loop devices (used by Snap)/proc and /sys — Virtual Filesystems
These are not real disk files but interfaces exposed by the kernel.
# Common /proc files
cat /proc/cpuinfo # CPU information
cat /proc/meminfo # Memory information
cat /proc/version # Kernel version
cat /proc/partitions # Partition information
# Common /sys files
cat /sys/class/power_supply/BAT0/capacity # Battery level
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor # CPU frequency governor/run — Runtime Data
Temporary runtime data generated after system boot; cleared on reboot.
/run/
├── user/1000/ # Current user runtime data
├── snapd/ # Snap runtime
├── lock/ # Lock files
└── systemd/ # systemd runtimeQuick Lookup
# Find the path of a command
which command-name
type command-name
# Find which package owns a file
dpkg -S /path/to/file
# List files installed by a package
dpkg -L package-nameLast updated on