`
suliuyes
  • 浏览: 92381 次
  • 性别: Icon_minigender_1
  • 来自: 成都
文章分类
社区版块
存档分类
最新评论

Linux目录结构

 
阅读更多

/:根目录,一般根目录下只存放目录,不要存放文件,/etc、/bin、/dev、/lib、/sbin应该和根目录放置在一个分区中

/bin:/usr/bin:执行二进制文件的目录,如常用的命令ls、tar、mv、cat等。

/boot:放置linux系统启动时用到的一些文件。/boot/vmlinuz为linux的内核文件,以及/boot/gurb。建议单独分区,分区大小100M即可

/dev:存放linux系统下的设备文件,访问该目录下某个文件,相当于访问某个设备,常用的是挂载光驱mount /dev/cdrom /mnt。

/etc:系统配置文件存放的目录,不建议在此目录下存放可执行文件,重要的配置文件有/etc/inittab、/etc/fstab、/etc/init.d、/etc/X11、/etc/sysconfig、/etc/xinetd.d修改配置文件之前记得备份。

注:/etc/X11存放与x windows有关的设置。

/home:系统默认的用户家目录,新增用户账号时,用户的家目录都存放在此目录下,~表示当前用户的家目录,~test表示用户test的家目录。建议单独分区,并设置较大的磁盘空间,方便用户存放数据

/lib:/usr/lib:/usr/local/lib:系统使用的函数库的目录,程序在执行过程中,需要调用一些额外的参数时需要函数库的协助,比较重要的目录为/lib/modules。

/lost+fount:系统异常产生错误时,会将一些遗失的片段放置于此目录下,通常这个目录会自动出现在装置目录下。如加载硬盘于/disk 中,此目录下就会自动产生目录/disk/lost+found

/mnt:/media:光盘默认挂载点,通常光盘挂载于/mnt/cdrom下,也不一定,可以选择任意位置进行挂载。

/opt:给主机额外安装软件所摆放的目录。如:FC4使用的Fedora 社群开发软件,如果想要自行安装新的KDE 桌面软件,可以将该软件安装在该目录下。以前的 Linux 系统中,习惯放置在 /usr/local 目录下

/proc:此目录的数据都在内存中,如系统核心,外部设备,网络状态,由于数据都存放于内存中,所以不占用磁盘空间,比较重要的目录有/proc/cpuinfo、/proc/interrupts、/proc/dma、/proc/ioports、/proc/net/*等

/root:系统管理员root的家目录,系统第一个启动的分区为/,所以最好将/root和/放置在一个分区下。

/sbin:/usr/sbin:/usr/local/sbin:放置系统管理员使用的可执行命令,如fdisk、shutdown、mount等。与/bin不同的是,这几个目录是给系统管理员root使用的命令,一般用户只能"查看"而不能设置和使用。

/tmp:一般用户或正在执行的程序临时存放文件的目录,任何人都可以访问,重要数据不可放置在此目录下

/srv:服务启动之后需要访问的数据目录,如www服务需要访问的网页数据存放在/srv/www内

/usr:应用程序存放目录,/usr/bin存放应用程序,/usr/share存放共享数据,/usr/lib存放不能直接运行的,却是许多程序运行所必需的一些函数库文件。/usr/local:存放软件升级包。/usr/share/doc:系统说明文件存放目录。/usr/share/man: 程序说明文件存放目录,使用 man ls时会查询/usr/share/man/man1/ls.1.gz的内容建议单独分区,设置较大的磁盘空间

/var:放置系统执行过程中经常变化的文件,如随时更改的日志文件/var/log,/var/log/message:所有的登录文件存放目录,/var/spool/mail:邮件存放的目录,/var/run:程序或服务启动后,其PID存放在该目录下。建议单独分区,设置较大的磁盘空间

 

对于linux新手来说,最感到迷惑的问题之一就是文件都存在哪里呢?特别是对于那些从windows转过来的新手来说,linux的目录结构看起来有些奇怪哦。所以,在这里讲一下linux下的主要目录以及它们都是用来干什么的。 

  / 

  This is the root directory. The mothership. The home field. The one and only top directory for your whole computer. Everything, and I mean EVERYTHING starts here. When you type '/home' what you're really saying is "start at / and then go to the home directory." 

  / 

  这就是根目录。对你的电脑来说,有且只有一个根目录。所有的东西,我是说所有的东西都是从这里开始。举个例子:当你在终端里输入“/home”,你其实是在告诉电脑,先从/(根目录)开始,再进入到home目录。 

  /root 

  This is where the root user lives. The root user is the god of your system. Root can do anything, up to and including removing your entire filesystem. So be careful using root. 

  /root 

  这是系统管理员(root user)的目录。对于系统来说,系统管理员就好比是上帝,它能对系统做任何事情,甚至包括删除你的文件。因此,请小心使用root帐号。 

  /bin 

  Here's where your standard linux utilities(read programs) live -- things like "ls" and "vi" and "more". Generally this directory is included in your path. What this means is that if you type 'ls', /bin is one of the places your shell will look to see if 'ls' means anything. 

  /bin 

  这里存放了标准的(或者说是缺省的)linux的工具,比如像“ls”、“vi”还有“more”等等。通常来说,这个目录已经包含在你的“path”系统变量里面了。什么意思呢?就是:当你在终端里输入ls,系统就会去/bin目录下面查找是不是有ls这个程序。 

  /etc 

  Here's where the administrative and system configuration stuff lives. For instance, if you have samba installed, and you want to modify the samba configuration files, you'd find them in /etc/samba. 

  /etc 

  这里主要存放了系统配置方面的文件。举个例子:你安装了samba这个套件,当你想要修改samba配置文件的时候,你会发现它们(配置文件)就在/etc/samba目录下。 

  /dev 

  Here's where files that control peripherals live. Talking to a printer? Your computer is doing it from here. Same goes for disk drives, usb devices, and other such stuff. 

  /dev 

  这里主要存放与设备(包括外设)有关的文件(unix和linux系统均把设备当成文件)。想连线打印机吗?系统就是从这个目录开始工作的。另外还有一些包括磁盘驱动、USB驱动等都放在这个目录。 

  /home 

  Here's where your data is stored. Config files specific to users, your Desktop folder(whick makes your desktop what it is), and any data related to your user. Each user will have their own /home/username folder, with the exception of the root user. 

  /home 

  这里主要存放你的个人数据。具体每个用户的设置文件,用户的桌面文件夹,还有用户的数据都放在这里。每个用户都有自己的用户目录,位置为:/home/用户名。当然,root用户除外。 

  /tmp 

  This is the Temporary folder. Think of it as a scratch directory for your Linux system. Files that won't be needed by programs once their used once or twice are put here. Many Linux systems are set to automatically wipe the /tmp folder at certain intervals, so don't put things you want to keep here. 

  /tmp 

  这是临时目录。对于某些程序来说,有些文件被用了一次两次之后,就不会再被用到,像这样的文件就放在这里。有些linux系统会定期自动对这个目录进行清理,因此,千万不要把重要的数据放在这里。 

  /usr 

  Here's where you'll find extra utilities that don't fit under /bin or /etc. Things like games, printer utilities, and whatnot. /usr is divided into sections like /usr/bin for programs, /usr/share for shared data like sound files or icons, /usr/lib for libraries whick cannot be directly run but are essential for running other programs.Your package manager takes care of the things in /usr for you. 

  /usr 

  在这个目录下,你可以找到那些不适合放在/bin或/etc目录下的额外的工具。比如像游戏阿,一些打印工具拉等等。/usr目录包含了许多子目录:/usr/bin目录用于存放程序;/usr/share用于存放一些共享的数据,比如音乐文件或者图标等等;/usr/lib目录用于存放那些不能直接运行的,但却是许多程序运行所必需的一些函数库文件。你的软件包管理器(应该是“新立得”吧)会自动帮你管理好/usr目录的。 

  /opt 

  Here's where optional stuff is put. Trying out the latest Firefox beta? Install it to /opt where you can delete it without affecting other settings. Programs in here usually live inside a single folder whick contains all of their data, libraries, etc. 

  /opt 

  这里主要存放那些可选的程序。你想尝试最新的firefox测试版吗?那就装到/opt目录下吧,这样,当你尝试完,想删掉firefox的时候,你就可以直接删除它,而不影响系统其他任何设置。安装到/opt目录下的程序,它所有的数据、库文件等等都是放在同个目录下面。 

  举个例子:刚才装的测试版firefox,就可以装到/opt/firefox_beta目录下,/opt/firefox_beta目录下面就包含了运行firefox所需要的所有文件、库、数据等等。要删除firefox的时候,你只需删除/opt/firefox_beta目录即可,非常简单。 

  /usr/local 

  This is where most manually installed(ie. outside of your package manager) software goes. It has the same structure as /usr. It is a good idea to leave /usr to your package manager and put any custom scripts and things into /usr/local, since nothing important normally lives in /usr/local. 

  /usr/local 

  这里主要存放那些手动安装的软件,即不是通过“新立得”或apt-get安装的软件。它和/usr目录具有相类似的目录结构。让软件包管理器来管理/usr目录,而把自定义的脚本(scripts)放到/usr/local目录下面,我想这应该是个不错的主意。 

  /media 

  Some distros use this folder to mount things like usb disks, cd or dvd drives and other filesystems. 

  /media 

  有些linux的发行版使用这个目录来挂载那些usb接口的移动硬盘(包括U盘)、CD/DVD驱动器等等。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics