Linux /var 中有什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18514447/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-07 00:42:23  来源:igfitidea点击:

What goes in /var?

linuxcommand

提问by dasdasdasdasd

I read The Linux Command Line by William Shotts, and there are some descriptions of linux files(system directories) "The /vardirectory 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."

我阅读了 William Shotts 的 The Linux Command Line,其中有一些关于 linux 文件(系统目录)的描述“/var目录内容不会改变。这棵树是存储可能改变的数据的地方。各种数据库、假脱机文件、用户邮件等位于此处。”

I am interested, if /vardirectory contents don't change, why will be exists wwwfolder in /var/wwwafter install `apache-php``.

我很感兴趣,如果/var目录内容没有改变,为什么 在安装 `apache-php` 后会存在www文件夹/var/www

/var/wwwfolder is where we must edit, create or delete files, this is a localhost public directory, can you give me answer? Why did he say, that the /vardirectory contents don't change.

/var/www文件夹是我们必须编辑、创建或删除文件的地方,这是一个本地主机公共目录,你能给我答案吗?他为什么说,/var目录内容不会改变。

采纳答案by akumapunk

I'd say that the contents in /var don't change so often. In my experience it's mostly used to store database files, cache files and of course, the /var/www directory. These objects do change but for example, a website doesn't change every second.

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

回答by Fred Foo

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

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

回答by Basile Starynkevitch

The definition of various files (including directories) which are expected to be available is given by the Linux File-system Hierarchy Standardand the Linux Standard Base. The /var hierarchy

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

contains variable data files. This includes spool directories and files, administrative and logging data, and transient and temporary files.

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

Interestingly /var/www/is not defined in such normative specifications.

有趣的/var/www/是在这样的规范规范中没有定义。

回答by nelaaro

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