/private/var 文件夹

原文地址:

https://shellzero.wordpress.com/2012/06/23/importance-of-var-folder-in-macosx/


各文件夹说明

/private/var

这个文件夹默认是隐藏的,其实他是个软连接。

这个文件夹包含了系统进程,比如打印保存日志文件。也会保存不少的配置信息。


/private/var/backups

用来保存一些关键系统信息的备份。


/private/var/db

which together store much of the system and network configuration information that a traditional unix admin would expect to find in /etc, and a Mac OS 10 admin would expect to find in System Folder:Preferences.

保存很多系统信息的数据库。

最值得注意的是,

保存了网络信息数据库,在 /var/db/netinfo 中;

保存了加密口令文件,在 /var/db/shadow/hash 中

还有系统的网络配置数据库,原来在 /var/db/SystemConfiguration/preferences.xml 中,10.6时移到了 /Library/Preferences/SystemConfiguration/。

一些重要的网络配置文件,传统的unix系统会保存在 /etc 中。macOS 10 会放在 /Library/Preferences 中。


/private/var/log

这里会保存很多系统事件的日志。其他日志会保存在 /Library/Logs


/private/var/root

这是root用户的主目录。及时你没有让root有效,这个文件夹也会存在。


/private/var/run

保存不同进程运行时的状态信息。


/private/var/tmp

给程序保存临时数据,和 /tmp 比较像。有的程序会使用 /private/var/tmp 来保存,有的程序使用 /tmp,macOS 会同时支持这两种。


/private/var/vm

用来保存macOS虚拟内存的交换文件。


/private/var/vm/app_profile

保存不同应用对虚拟内存的使用。


删除提示

不要删除这些目录,否则会导致数据丢失和APP 无法使用。

如果你不小心删掉了 /private/var,可查看这篇文章:https://shellzero.wordpress.com/2012/06/23/deletion-of-var-directory-on-macosx/

大意如下:

如果你删除了这个文件夹,后果会非常严重如下:

  • 很多app无法正常使用;
  • 终端无法使用,web 浏览器偶尔可以运行;
  • 复制功能无法使用,你会获得 8003 错误;
  • 无法压缩文件或文件夹,幸运的话部分可以压缩;
  • 使用 Time Machine 进行备份会受到限制;
  • 如果你关闭系统,他可能无法再次启动。
  • mac 会进入睡眠欧式;
  • 恢复的软件不起作用,而且你无法安装其他app.

唯一的解决方法是,重新安装 Mac 系统。

如果你有重要的文件需要拷贝,可以通过蓝牙传输重要数据。因为蓝牙是此时唯一一个可以完美运行程序。

你重启电脑时,mac在重启时不会有相应。这些情境下,你的电脑会拒绝开启,你无法获取任何硬盘数据。


原文

Importance of var folder

  • /var – This is actually a hidden folder in mac! Until and unless you make your mac to show the hidden files, this file will not be visible. This is actually under the /private/var.The directory which you see is the shortcut.It is just a symbolic link.Now lets see what is its significance! The folder contains the processes controlled by the operating system.Processes like printing and the programs that store the log files will use the sub directories in the /var directory to store those files.It also holds a fair bit of configuration information [especially /var/db]
  • /var/backups – Used to store backups of critical system information.
  • /var/db – Holds various databases of the system information.The most notable are the netinfo databases(stored in /var/db/netinfo), shadow password files(in**/var/db/shadow/hash**),and the system’s network configuration database (/var/db/SystemConfiguration/preferences.xml although it moved to**/Library/Preferences/SystemConfiguration/ in 10.6**), which together store much of the system and network configuration information that a traditional unix admin would expect to find in /etc, and a Mac OS 10 admin would expect to find in System Folder:Preferences.
  • /var/log – This is where many of the system event logs are kept (others are kept in**/Library/Logs**).
  • /var/root -The root (superuser) account’s home directory. Note that this directory will exist even if you haven’t enabled the root account.
  • /var/run – Stores various status information about processes (especially daemons) running on the system.
  • /var/tmp – A place for programs to store temporary data, just like /tmp. Some programs use one, some use the other, so Mac OS X provides both.
  • /var/vm – Used to store the swap files for Mac OS X’s virtual memory.
  • /var/vm/app_profile – Holds information about various applications’ virtual memory usage.

Never delete this directory because it leads to many severe problems such as data loss and non functionality of your applications! Check out the post in case if you have deleted the /var folder accidentally.

猜你喜欢

转载自blog.csdn.net/lovechris00/article/details/80894078