Linux annotated directory structure

This is mostly relevant to Ubuntu, but the major GNU/Linux distros share most of these paths.

  • / "root"
    • bin "essential binaries"
    • boot "static files of boot loader"
    • etc "host-specific system configuration"
      • opt "config file for add-on application software"
    • usr "shareable and read-only data"
      • local "local software"
      • share "static data shareable among all architectures"
        • man "manual pages"
      • bin "most user commands"
      • include "standard C includes"
      • lib "obj, bin, and lib files for programs and packages"
      • sbin "non-essential binaries"
    • var "variable data files"
      • cache "application cache data"
      • lib "variable state information remains after reboot" [?]
      • yp "data for NIS services"
      • lock "lock files for shared resources"
      • opt "variable data of packages installed"
      • run "info of system since it was booted"
      • tmp "available for programs"
      • spool "data awaiting processing"
        • lpd
        • mqueue
        • news
        • rwho
        • uucp
      • log "log files and directories, often organized by package name"
    • sbin "system binaries"
    • tmp "temporary files deleted on bootup"
    • dev "special or device files"
    • home "user home directories"
    • lib "library and kernel modules"
    • mnt "mount files for temporary filesystems"
    • opt "add-on application software"
    • root "home directory for root user"

Common tasks:

  • Find a log file for %PACKAGE% by going to the /var/log/%PACKAGE% directory (e.g. apache2) or finding /var/log/%PACKAGE%.log.
  • Restart a service by issuing the command /etc/init.d/%PACKAGE% restart (e.g. ssh). You may have to append "d" to the end of the package or service name -- mysqld, for example. "d" stands for "daemon", a process that runs in the background, waiting to be called.