【问题标题】:What goes in /var?/var 中有什么?
【发布时间】:2013-09-02 02:14:48
【问题描述】:

我看了William Shotts的The Linux Command Line,里面有一些Linux文件(系统目录)的描述:

/var 目录内容不会改变。这棵树是存储可能更改的数据的地方。各种数据库、假脱机文件、用户邮件等都位于此处。

我想知道:如果/var目录内容不应该改变,为什么在安装apache-php之后/var/www中有www目录?

/var/www 目录是我们必须编辑、创建或删除文件的地方。这是一个 localhost 公共目录。

他为什么说/var 目录内容不会改变?

【问题讨论】:

  • 不要改变。这棵树是数据可能改变”的地方——这句话是自相矛盾的
  • @dasdasdasdasd,你能改变接受的答案吗?
  • 这真的是你书中所说的吗?我在威廉·肖茨 (William Shotts) 的“Linux 命令行” 17.10 版中的第 23 页上可以找到更有意义的内容:“除了 /tmp 和 /home 之外,到目前为止我们查看的目录仍然相对静态,也就是说,它们内容不会改变。/var 目录树是存储可能更改的数据的位置。各种数据库、假脱机文件、用户邮件等都位于此处。”

标签: linux command


【解决方案1】:

/var 的描述自相矛盾。 /var 包含易于更改的内容,例如网站、临时文件 (/var/tmp) 和数据库。名称是“变量”的缩写。

【讨论】:

  • 接受的答案和这个相互冲突。但这有更多的选票。谁能帮忙!!
  • @Sandeep 我认为接受的答案是由提出问题的人选择的。此人在选择可接受的答案之前可能没有足够的信息。一般来说,得票多的答案会帮助更多的人。我建议阅读每个答案下方的 cmets,并在做出决定之前点击答案作者提供的任何链接。在我看来,对于这个问题,接受的答案是不正确的。
  • 变化可能不止一种方式。可变文件的大小(占用空间)或数量可能会发生变化。如果您有一定数量的文件可能会随着时间的推移而增长(即由于日志附加或轮换),请使用 /var,以免磁盘空间不足。
【解决方案2】:

人家

   /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).

【讨论】:

【解决方案3】:

Linux File-system Hierarchy StandardLinux Standard Base 给出了预期可用的各种文件(包括目录)的定义。 /var hierarchy

包含可变数据文件。这包括假脱机目录和文件、管理和日志记录数据以及临时和临时文件。

有趣的是,/var/www/ 并未在此类规范规范中定义。

【讨论】:

    【解决方案4】:

    我会说 /var 中的内容不会经常更改。 根据我的经验,它主要用于存储数据库文件、缓存文件,当然还有 /var/www 目录。 这些对象确实会发生变化,但例如,网站并非每秒都在变化。

    【讨论】:

    • 但它也包含像 /var/log 这样的东西,在繁忙的系统上,它可能会在亚秒级的时间尺度上发生显着变化......
    猜你喜欢
    • 2019-09-21
    • 2018-12-07
    • 1970-01-01
    • 1970-01-01
    • 2013-06-28
    • 2013-08-10
    • 1970-01-01
    • 1970-01-01
    • 2011-06-01
    相关资源
    最近更新 更多