Linux系统目录架构

时间:2021-11-16 22:28:03

Linux系统目录架构

<span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong><span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong></strong></span></span>1. /</strong></span></span> 文件系统的入口,<span style="font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">最高一级目录</span>;

</span><span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong>2. /bin</strong></span></span> <span style="font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">基础系统所需要的命令位于此目录</span>,是最小系统所需要的命令,如:</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">ls, cp, mkdir</span><span style="font-size:14px;">等。
这个目录中的文件都是可执行的,一般的用户都可以使用。

</span><span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong>3. /boot</strong></span></span> 包含<span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">Linux</span></span><span style="font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">内核及系统引导程序所需要的文件</span>,比如 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">vmlinuz initrd.img </span><span style="font-size:14px;">文件都位于这个目录中。在一般情况下,</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">GRUB</span></span><span style="font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">或<span style="font-family:Nimbus Mono L, Courier New, monospace;">LILO</span></span><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">系统引导管理器</span>也位于这个目录;

</span><span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong>4. /dev</strong></span></span> (Device)<span style="font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">设备文件存储目录</span>,比如声卡、磁盘</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">... ...</span> 这是一个非常有趣的目录,是<span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">Linux</span><span style="font-size:14px;">文件系统的一个闪亮的特性 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">- </span><span style="font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">所有对象都是文件或目录</span>。仔细观察这个目录你会发现</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">hda1, hda2</span><span style="font-size:14px;">等</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">, </span><span style="font-size:14px;">它们代表系统主硬盘的不同分区。
</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/dev/cdrom</span><span style="font-size:14px;">和</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/dev/fd0</span><span style="font-size:14px;">代表你的</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">CDROM</span><span style="font-size:14px;">驱动器和</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">floppy</span><span style="font-size:14px;">驱动器。看上去可能有些奇怪,但比较文件和硬件的特性这却是十分合理的。它们都可以读出和写入。例如</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/dev/dsp</span><span style="font-size:14px;">,这个文件代表你的扬声器。那么写入这个文件的数据都回传送到喇叭。试一试 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">'cat /etc/lilo.conf > /dev/dsp' </span><span style="font-size:14px;">你会听到一些声音。这是你的 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">lilo.conf </span><span style="font-size:14px;">文件的声音!同样,向 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/dev/ttyS0 ( COM 1 ) </span><span style="font-size:14px;">读出或写入数据你可以和接到上面的设备进行通讯。

</span><span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong>5. /etc</strong></span></span> <span style="font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">存放系统程序或者一般工具的配置文件</span>。(纯文本,以.conf结尾)
如安装了</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">apache2</span><span style="font-size:14px;">之后,配置文件在</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/etc/apache2/</span><span style="font-size:14px;">目录下。
</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/etc/init.d </span><span style="font-size:14px;">这个目录是用来存放系统或服务器以</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">System V</span><span style="font-size:14px;">模式启动的脚本,这在以</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">System V</span><span style="font-size:14px;">模式启动或初始化的系统中常见。
如</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;"><span style="BACKGROUND: rgb(125,166,71) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">apache2</span></span><span style="font-size:14px;"><span style="BACKGROUND: rgb(125,166,71) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">的<span style="font-family:Nimbus Mono L, Courier New, monospace;">/etc/init.d apache2 start|stop|restart</span></span></span> <span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;"><span style="BACKGROUND: rgb(125,166,71) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">MySQL</span></span><span style="font-size:14px;"><span style="BACKGROUND: rgb(125,166,71) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">为<span style="font-family:Nimbus Mono L, Courier New, monospace;">/etc/init.d mysql start|stop|restart</span></span></span> 
<span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong>6. /home</strong></span></span> <span style="font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">普通用户默认存放目录</span></span> <span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">Linux </span><span style="font-size:14px;">是多用户环境,所以每一个用户都有一个只有自己可以访问的目录(当然管理员也可以访问)。它们以 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/home/username </span><span style="font-size:14px;">的方式存在。这个目录也保存一些应用对于这个用户的配置,比如 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">IRC, X </span><span style="font-size:14px;">等。 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;"><span style="color:#c90016;"><strong>7. /lib</strong></span> </span> <span style="font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">库文件存放目录</span><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">这里包含了系统程序所需要的所有共享库文件</span>,类似于 </span> <span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">Windows </span><span style="font-size:14px;">的共享库 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">DLL </span><span style="font-size:14px;">文件。 </span><span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong>8. /lost+found</strong></span></span> 在<span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">ext2</span><span style="font-size:14px;">或</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">ext3</span><span style="font-size:14px;">文件系统中,<span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">当系统意外崩溃或机器意外关机,而产生一些文件碎片放在这里</span>。当系统启动的过程中</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">fsck</span><span style="font-size:14px;">工具会检查这里,并修复已经损坏的文件系统。 有时系统发生问题,有很多的文件被移到这个目录中,可能会用手工的方式来修复,或移到文件到原来的位置上。</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">Linux </span><span style="font-size:14px;">应该正确的关机。但有时你的系统也可能崩溃掉或突然断电使系统意外关机。那么启动的时候 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">fsck </span><span style="font-size:14px;">将会进行长时间的文件系统检查。</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">Fsck </span><span style="font-size:14px;">会检测并试图恢复所发现的不正确的文件。被恢复的文件会放置在这个目录中。所恢复的文件也许并不完整或并不合理,但毕竟提供了一些恢复数据的机会。  </span><span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong>9. /media </strong></span></span>即插即用型<span style="font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">存储设备的挂载点</span>自动在这个目录下创建,比如</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">USB</span><span style="font-size:14px;">盘系统自动挂载后,会在这个目录下产生一个目录 ;</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">CDROM/DVD</span><span style="font-size:14px;">自动挂载后,也会在这个目录中创建一个目录,类似</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">cdrom </span><span style="font-size:14px;">的目录。这个只有在最新的发行套件上才有</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">.</span> 
<span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong>10. /mnt</strong></span></span> <span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/mnt </span><span style="font-size:14px;">这个目录一般是用于存放挂载储存设备的挂载目录的,比如有</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">cdrom </span><span style="font-size:14px;">等目录。有时我们可以把让系统开机自动挂载文件系统,把挂载点放在这里也是可以的。比如光驱可以挂载到</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/mnt/cdrom </span><span style="font-size:14px;">。 这是一个普通的加载目录,在这里你可以加载你的文件系统或设备。加载是使一个文件系统对于系统可用的过程。在加载后你的文件可以在加载目录下访问。这个目录通常包含加载目录或用于加载软驱和光驱的子目录。如果需要,你也可以在这里建立其它的加载目录。对于加载目录的位置并没有强制性的要求,你可以在系统的任意位置建立加载目录。建立 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/mnt </span><span style="font-size:14px;">只是为了使系统更工整的惯例。  </span><span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong>11. /opt (一般装一些大型软件)</strong></span></span>表示的是可选择的意思,<span style="font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">有些软件包也会被安装在这里,也就是自定义软件包</span>,比如在</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">Fedora Core 5.0</span><span style="font-size:14px;">中,</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">OpenOffice</span><span style="font-size:14px;">就是安装在这里。<span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">有些我们自己编译的软件包,就可以安装在这个目录中</span>;通过源码包安装的软件,可以通过 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">./configure --prefix=/opt/</span><span style="font-size:14px;">,将软件安装到</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">opt</span><span style="font-size:14px;">目录。 这个目录包含所有默认系统安装之外的软件和添加的包。 </span><span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong>12. /proc</strong></span></span> 操作系统运行时,进程(正在运行中的程序)信息及内核信息(比如<span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">cpu</span><span style="font-size:14px;">、硬盘分区、内存信息等)存放在这里。</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/proc</span><span style="font-size:14px;">目录是伪装的文件系统</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">proc</span><span style="font-size:14px;">的挂载目录,</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">proc</span><span style="font-size:14px;">并不是真正的文件系统。这是系统中极为特殊的一个目录,实际上任何分区上都不存在这个目录。它实际是个实时的、驻留在<strong>内存</strong>中的文件系统。  </span><span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong>13. /root </strong></span></span> <span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">Linux</span><span style="font-size:14px;">超级权限用户</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">root</span><span style="font-size:14px;">的家目录; </span><span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong>14. /sbin </strong></span></span>大多是涉及<span style="font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">系统管理的命令的存放,是超级权限用户<span style="font-family:Nimbus Mono L, Courier New, monospace;">root</span></span><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">的可执行命令存放地</span>,普通用户无权限执行这个目录下的命令;这个目录和</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/sbin; </span> <span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/X11R6/sbin</span><span style="font-size:14px;">或</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/local/sbin</span> 目录是相似的; 我们记住就行了,凡是目录<span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">sbin</span><span style="font-size:14px;">中包含的都是</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">root</span><span style="font-size:14px;">权限才能执行的。 </span><span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong>15. /tmp</strong></span></span> 临时文件目录,有时用户运行程序的时候,会产生临时文件。 <span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/tmp</span><span style="font-size:14px;">就用来存放临时文件的。</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/var/tmp</span><span style="font-size:14px;">目录和这个目录相似。许多程序在这里建立</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">lock</span><span style="font-size:14px;">文件和存储临时数据。有些系统会在启动或关机时清空此目录。 </span><span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong>16. /usr</strong></span></span> 这个是<span style="font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">系统存放程序的目录</span>,比如命令、帮助文件等。这个目录下有很多的文件和目录。当我们安装<span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">一个<span style="font-family:Nimbus Mono L, Courier New, monospace;">Linux</span></span><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">发行版官方提供的软件包时,大多安装在这里</span>。如果有涉及服务器配置文件的,会把配置文件安装在</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/etc</span><span style="font-size:14px;">目录中。 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr</span><span style="font-size:14px;">目录下包括:涉及字体目录</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/share/fonts </span><span style="font-size:14px;">,帮助目录 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/share/man</span><span style="font-size:14px;">或</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/share/doc</span><span style="font-size:14px;">,普通用户可执行文件目录</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/bin </span><span style="font-size:14px;">或</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/local/bin </span><span style="font-size:14px;">或</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/X11R6/bin </span><span style="font-size:14px;">,超级权限用户</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">root</span><span style="font-size:14px;">的可执行命令存放目录,比如 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/sbin </span><span style="font-size:14px;">或</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/X11R6/sbin </span><span style="font-size:14px;">或</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/local/sbin </span><span style="font-size:14px;">等;还有程序的头文件存放目录</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/include</span><span style="font-size:14px;">。 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/bin </span><span style="font-size:14px;">这个目录是可执行程序的目录,普通用户就有权限执行; 当我们从系统自带的软件包安装一个程序时,他的可执行文件大多会放在这个目录。</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/sbin </span><span style="font-size:14px;">这个目录也是可执行程序的目录,但大多存放涉及系统管理的命令。只有</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">root</span><span style="font-size:14px;">权限才能执行;相似目录是</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/sbin </span><span style="font-size:14px;">或</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/local/sbin</span><span style="font-size:14px;">或</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/X11R6/sbin</span><span style="font-size:14px;">等; </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/local </span><span style="font-size:14px;">这个目录一般是用来存放用户自编译安装软件的存放目录;一般是通过源码包安装的软件,如果没有特别指定安装目录的话,一般是安装在这个目录中。这个目录下面有子目录。</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/lib </span><span style="font-size:14px;">和</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/lib </span><span style="font-size:14px;">目录相似,是库文件的存储目录;</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/share </span><span style="font-size:14px;">系统共用的东西存放地,比如 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/share/fonts </span><span style="font-size:14px;">是字体目录,是用户都共用的吧。</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/share/doc</span><span style="font-size:14px;">和</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/share/man</span><span style="font-size:14px;">帮助文件,也是共用的吧; </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/src </span><span style="font-size:14px;">是内核源码存放的目录,比如下面有内核源码目录,比如 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">linux </span><span style="font-size:14px;">、</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">linux-2.xxx.xx </span><span style="font-size:14px;">目录等。有的系统也会把源码软件包安装在这里。比如</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">Fedora/Redhat</span><span style="font-size:14px;">,当我们安装</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">file.src.rpm</span><span style="font-size:14px;">的时候,这些软件包会安装在 </span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/src/redhat</span><span style="font-size:14px;">相应的目录中。请参考: 《</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">file.src.rpm </span><span style="font-size:14px;">使用方法的简单介绍》 。另外</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">Fedhat 4.0 5.0</span><span style="font-size:14px;">,他的内核源码包的目录位于</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/usr/src/kernels</span><span style="font-size:14px;">目录下的某个目录中(只有安装后才会生成相应目录); </span><span style="font-size:14px;color:#c90016;"><span style="font-family:Nimbus Mono L, Courier New, monospace;"><strong>17. /var</strong></span></span> <span style="font-size:14px;"><span style="BACKGROUND: rgb(255,255,0) 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">这个目录的内容是经常变动的</span>,看名字就知道,我们可以理解为</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">vary</span><span style="font-size:14px;">的缩写,</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/var</span><span style="font-size:14px;">下有</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/var/log </span><span style="font-size:14px;">这是用来存放系统日志的目录。</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/var/www</span><span style="font-size:14px;">目录是定义</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">Apache</span><span style="font-size:14px;">服务器站点存放目录;</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/var/lib </span><span style="font-size:14px;">用来存放一些库文件,比如</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">MySQL</span><span style="font-size:14px;">的,以及</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">MySQL</span><span style="font-size:14px;">数据库的的存放地;</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/var/log </span><span style="font-size:14px;">系统日志存放,分析日志要看这个目录的东西;</span><span style="font-family:Nimbus Mono L, Courier New, monospace;font-size:14px;">/var/spool </span><span style="font-size:14px;">打印机、邮件、代理服务器等假脱机目录;</span>