Linux 目录结构

Interesting directories and their contents
Directory Description
/ The root directory where the file systembegins. In most cases the root directory onlycontains subdirectories.
/boot This is where the Linux kernel and boot loaderfiles are kept. The kernel is a file called vmlinuz.
/etc The /etc directorycontains the configuration files for thesystem. All of the files in /etc should be text files. Points ofinterest:
/etc/passwd
The passwd filecontains the essential information for eachuser. It is here that users aredefined.
/etc/fstab
The fstab filecontains a table of devices that get mountedwhen your system boots. This file definesyour disk drives.
/etc/hosts
This file lists the network host namesand IP addresses that are intrinsically knownto the system.
/etc/init.d
This directory contains the scriptsthat start various system services typicallyat boot time.
/bin,/usr/bin These two directories contain most of theprograms for the system. The /bin directory has the essentialprograms that the system requires to operate,while /usr/bin containsapplications for the system's users.
/sbin,/usr/sbin The sbin directoriescontain programs for system administration,mostly for use by the superuser.
/usr The /usr directorycontains a variety of things that supportuser applications. Some highlights:
/usr/share/X11
Support files for the X Windows system
/usr/share/dict
Dictionaries for the spelling checker.Bet you didn't know that Linux had aspelling checker. See look and ispell.
/usr/share/doc
Various documentation files in avariety of formats.
/usr/share/man
The man pages are kept here.
/usr/src
Source code files. If you installed thekernel source code package, you will findthe entire Linux kernel source codehere.
/usr/local /usr/local and itssubdirectories are used for the installationof software and other files for use on thelocal machine. What this really means is thatsoftware that is not part of the officialdistribution (which usually goes in /usr/bin) goes here.

When you find interesting programs toinstall on your system, they should beinstalled in one of the /usr/local directories. Mostoften, the directory of choice is /usr/local/bin.
/var The /var directorycontains files that change as the system isrunning. This includes:
/var/log
Directory that contains log files.These are updated as the system runs. Youshould view the files in this directoryfrom time to time, to monitor the health ofyour system.
/var/spool
This directory is used to hold filesthat are queued for some process, such asmail messages and print jobs. When a user'smail first arrives on the local system(assuming you have local mail), themessages are first stored in /var/spool/mail
/lib The shared libraries (similar to DLLs inthat other operating system) are kepthere.
/home /home is where userskeep their personal work. In general, this isthe only place users are allowed to writefiles. This keeps things nice and clean:-)
/root This is the superuser's homedirectory.
/tmp /tmp is a directoryin which programs can write their temporaryfiles.
/dev The /dev directoryis a special directory, since it does notreally contain files in the usual sense.Rather, it contains devices that are availableto the system. In Linux (like Unix), devicesare treated like files. You can read andwrite devices as though they were files. Forexample /dev/fd0 is thefirst floppy disk drive, /dev/sda (/dev/hda on older systems) is the first IDE harddrive. All the devices that the kernelunderstands are represented here.
/proc The /proc directoryis also special. This directory does notcontain files. In fact, this directory doesnot really exist at all. It is entirelyvirtual. The /procdirectory contains little peep holes into thekernel itself. There are a group of numberedentries in this directory that correspond toall the processes running on the system. Inaddition, there are a number of named entriesthat permit access to the currentconfiguration of the system. Many of theseentries can be viewed. Try viewing /proc/cpuinfo. This entry willtell you what the kernel thinks of yourCPU.
/media,/mnt Finally, we come to /media, a normal directory which isused in a special way. The /media directory is used formount points. As we learned in the second lesson, thedifferent physical storage devices (like harddisk drives) are attached to the file systemtree in various places. This process ofattaching a device to the tree is calledmounting. For a device to beavailable, it must first be mounted.

When your system boots, it reads a list ofmounting instructions in the file /etc/fstab, which describes whichdevice is mounted at which mount point in thedirectory tree. This takes care of the harddrives, but you may also have devices thatare considered temporary, such as CD-ROMs andfloppy disks. Since these are removable, theydo not stay mounted all the time. The /media directory is used by theautomatic device mounting mechanisms found inmodern desktop oriented Linux distributions.On systems that require manual mounting of removable devices, the /mnt directory provides aconvenient place for mounting these temporarydevices. You will oftensee the directories /mnt/floppy and /mnt/cdrom. To see what devicesand mount points are used, type mount.


/bin:bin是binary(二进制)的缩写。这个目录是对UNIX系统习惯的沿袭,存放着使用者最经常使用的命令。例如:cp,ls,cat。
/boot:这里存放的是启动LINUX时使用的一些核心文件。
/dev:dev是device(设备)的缩写。这个目录下是所有LINUX的外部设备,其功能类似DOS下的.sys和Win下的.vxd。在LINUX中设备和文件是用同种方法访问的。例如:/dev/hda代表第一个物理IDE硬盘。
/etc:这个目录用来存放所有的系统管理所需要的配置文件和子目录。
/home:用户的主目录,比如说有个用户叫liubin,那他的主目录就是/home/liubin也可以用~liubin表示,说到这里,打个岔,你现应该明白在我们访问一些个人网页(如http://www.liubin.net/~liubin)的时候,~liubin就是表示访问 www.liubin.net站点中的用户liubin的用户主目录。
如果这个网站的操作系统是LINUX,那就是表示/home/liubin。
/lib:这个目录里存放着系统最基本的动态链接共享库,其作用类似于Windows里的.dll文件。几乎所有的应用程序都需要用到这些共享库。
/lost+found:这个目录平时是空的,当系统不正常关机后,这里就成了一些无家可归的文件的避难所。对了,有点类似于DOS下的.chk文件。
/mnt:这个目录是空的,系统提供这个目录是让用户临时挂载别的文件系统。
/proc:这个目录是一个虚拟的目录,它是系统内存的映射,我们可以通过直接访问这个目录来获取系统信息。也就是说,这个目录的内容不在硬盘上而是在内存里啊!?
/root:系统管理员,也叫作超级权限者的用户主目录。当然系统的拥有者,总要有些特权啊!
/sbin:s就是Super User的意思,也就是说这里存放的是一些系统管理员使用的系统管理程序。
/tmp:这个目录不用说,一定是用来存放一些临时文件的地方了。
/usr:这是个最庞大的目录,我们要用到的很多应用程序和文件几乎都存放在这个目录下。具体来说:
/usr/X11R6 存放X-Windows的目录;
/usr/bin 存放着许多应用程序;
/usr/sbin 给超级用户使用的一些管理程序就放在这;
/usr/doc 这就是LINUX文档的大本营;
/usr/include LINUX下开发和编译应用程序需要的头文件,在这找;
/usr/lib 存放一些常用的动态链接共享库和静态档案库;
/usr/local 这是提供给一般用户的/usr目录,在这安装软件最适合;
/usr/man man是什么,对了是帮助。这里就是帮助文档目录啊!
/usr/src LINUX开放的源代码,就存在这个目录,爱好者们别放过哦!
/var:这个目录中存放着那些不断在扩充着的东西,为了保持/usr的相对稳定,那些经常被修改的目录可以放在这个目录下,实际上许多系统管理员都是这样干的。顺带说一下系统的日志文件就在/var/log目录中。

posted @ 2011-08-07 08:51  bambreeze  阅读(173)  评论(0编辑  收藏  举报