What goes in /var?

I read The Linux Command Line by William Shotts, and there are some descriptions of Linux files (system directories):

The /var directory contents don't change. This tree is where data that is likely to change is stored. Various databases, spool files, user mail, etc. are located here.

I am wondering: If the /var directory contents are not supposed to change, why is there a www directory in /var/www after installing apache-php?

The /var/www directory is where we must edit, create or delete files. This is a localhost public directory.

Why did he say, that the /var directory contents don't change?


That description of /var is self-contradictory. /var contains things that are prone to change, such as websites, temporary files (/var/tmp) and databases. The name is an abbreviation of "variable".


man hier

   /var   This directory contains files which may change in size, such as spool and log files.

   /var/account
          Process accounting logs (optional).

   /var/adm
          This directory is superseded by /var/log and should be a symbolic link to /var/log.

   /var/backups
          Reserved for historical reasons.

   /var/cache
          Data cached for programs.

   /var/cache/fonts
          Locally-generated fonts (optional).

   /var/cache/man
          Locally-formatted man pages (optional).

   /var/cache/www
          WWW proxy or cache data (optional).

   /var/cache/<package>
          Package specific cache data (optional).

   /var/catman/cat[1-9] or /var/cache/man/cat[1-9]
          These directories contain preformatted manual pages according to their man page section.  (The use of preformatted manual pages is deprecated.)

   /var/crash
          System crash dumps (optional).

   /var/cron
          Reserved for historical reasons.

   /var/games
          Variable game data (optional).

   /var/lib
          Variable state information for programs.

   /var/lib/hwclock
          State directory for hwclock (optional).

   /var/lib/misc
          Miscellaneous state data.

   /var/lib/xdm
          X display manager variable data (optional).

   /var/lib/<editor>
          Editor backup files and state (optional).

   /var/lib/<name>
          These directories must be used for all distribution packaging support.

   /var/lib/<package>
          State data for packages and subsystems (optional).

   /var/lib/<pkgtool>
          Packaging support files (optional).

   /var/local
          Variable data for /usr/local.

   /var/lock
          Lock files are placed in this directory.  The naming convention for device lock files is LCK..<device> where <device> is the device's name in the filesystem.  The format used is that  of  HDU
          UUCP lock files, that is, lock files contain a PID as a 10-byte ASCII decimal number, followed by a newline character.

   /var/log
          Miscellaneous log files.

   /var/opt
          Variable data for /opt.

   /var/mail
          Users' mailboxes.  Replaces /var/spool/mail.

   /var/msgs
          Reserved for historical reasons.

   /var/preserve
          Reserved for historical reasons.

   /var/run
          Run-time variable files, like files holding process identifiers (PIDs) and logged user information (utmp).  Files in this directory are usually cleared when the system boots.

   /var/spool
          Spooled (or queued) files for various programs.

    /var/spool
          Spooled (or queued) files for various programs.

   /var/spool/at
          Spooled jobs for at(1).

   /var/spool/cron
          Spooled jobs for cron(8).

   /var/spool/lpd
          Spooled files for printing (optional).

   /var/spool/lpd/printer
          Spools for a specific printer (optional).

   /var/spool/mail
          Replaced by /var/mail.

   /var/spool/mqueue
          Queued outgoing mail (optional).

   /var/spool/news
          Spool directory for news (optional).

   /var/spool/rwho
          Spooled files for rwhod(8) (optional).

   /var/spool/smail
          Spooled files for the smail(1) mail delivery program.

   /var/spool/uucp
          Spooled files for uucp(1) (optional).

   /var/tmp
          Like /tmp, this directory holds temporary files stored for an unspecified duration.

   /var/yp
          Database files for NIS, formerly known as the Sun Yellow Pages (YP).