目录层次表准FHS
FHS(filesystem HIErarchy standard)
FHS定义两层规范:1、“/”目录下的各个目录应该放什么文件数据
2、针对/usr /var两个目录的子目录来定义
目录 | 说明 |
/bin | (Essential user command BinarIEs (for use all useres)),常用二进制命令所在的目录。比如ls、cp、mkdir、rm、cut等命令;/bin目录和/usr/bin类似 [ [email protected] ~]# which cat /bin/cat [ [email protected] ~]# which mkdir /bin/mkdir cat ---->concatenate files and print on the standard output chgrp ---->change group ownership chmod ---->change file mode bit chown ---->change file owner and group cp ---->copy files and directorIEs date ----> print or set the system date and time dd ---->convert and copy a file df ---->report file system disk space usage dmesg ---->print or control the kernel ring buffer echo ---->display a line of text false ---->do nothing,unsuccessfully hostname---->show or set the system’s host name kill ---->kill sends the specifIEd signal to the specifIEd process or process group. ln ---->make links between files login ---->begin a session on the system ls ---->List directory contents mkdir ---->make directorIEs mknod ---->make block or character special files mount ---->mount a filesystem mv ---->move (rename) files ps ---->report a snapshot of the current processes. pwd ---->print name of current/working directory rm ---->remove files or directorIEs rmdir ---->remove empty directorIEs sed ---->stream editor for filtering and transforming text sh ---->GNU Bourne-Again SHell stty ---->change and print terminal line settings su ---->run a shell with substitute user and group IDs sync ---->flush file system buffers true ---->do nothing,successfully umonut ---->unmount file systems uname ---->print system information |
/boot | (static files of the boot loader)linux的内核及引导系统程序所需的文件目录。安装系统分区的时候一般要分一个boot分区。常见分区:/boot 128M swap内存的1.5倍 /全给。The operating system kernel must be located in either /or /boot [ [email protected] ~]# ll /boot/ total 24866 -rw-r--r--. 1 root root 106308 Oct 15 2014 config-2.6.32-504.el6.x86_64 drwxr-xr-x. 3 root root 1024 Jan 6 13:09 efi drwxr-xr-x. 2 root root 1024 Jan 6 13:10 grub -rw-------. 1 root root 18433397 Jan 6 13:10 initramfs-2.6.32-504.el6.x86_64.img drwx------. 2 root root 12288 Jan 6 13:07 lost+found -rw-r--r--. 1 root root 200191 Oct 15 2014 symvers-2.6.32-504.el6.x86_64.gz -rw-r--r--. 1 root root 2544748 Oct 15 2014 System.map-2.6.32-504.el6.x86_64 -rwxr-xr-x. 1 root root 4152336 Oct 15 2014 vmlinuz-2.6.32-504.el6.x86_64 |
/dev | (Device files)设备文件的目录,比如声卡、磁盘、光驱……。 /dev/null 清空文件的方法 Cat /dev/null >文件 All data written to this device is discarded.A read from this device will return an EOF condition. /dev/zero This device is a source of zerod out data.All data written to this device is discarded.A read from this. /dev/tty This device is a synonym for the controlling terminal of a process.Once this device |
/etc | (HOST-specific system configuration) 二进制安装包(yum,rpm)的配置文件默认路径 exports ---->NFS filesystem access control List(optional) fstab ---->Static information about filesystems(optional) hosts ---->Static information about host names(optional) inittab ---->Configuration file for init(optional) issue ---->Pre-login message and IDentification file(optional) ld.so.conf ---->List of extra directorIEs to search for shared librarIEs(optional) motd ---->Post-login message of the day file(optional) networks ---->Static information about network names(optional) passwd ---->The password file(optional) profile ---->SystemwIDe initialization file for sh shell logins(optional) resolv.conf ---->Resolves configuration file(optional) services ---->Port names for network services(optional) syslog.conf ---->Configuration file for syslogd(optional) 服务启动命令存放的目录/etc/init.d(yum,rpm) [ [email protected] ~]$ ls -l /etc/init.d/ total 176 -rwxr-xr-x. 1 root root 3580 Oct 15 2014 auditd -r-xr-xr-x. 1 root root 1340 Oct 15 2014 blk-availability -rwxr-xr-x. 1 root root 2826 Nov 23 2013 crond -rw-r--r--. 1 root root 19295 Jul 22 2014 functions -rwxr-xr-x. 1 root root 5866 Jul 22 2014 halt -rwxr-xr-x. 1 root root 2001 Oct 16 2014 htcacheclean -rwxr-xr-x. 1 root root 3371 Oct 16 2014 httpd -rwxr-xr-x. 1 root root 10804 Oct 15 2014 ip6tables -rwxr-xr-x. 1 root root 10688 Oct 15 2014 iptables -rwxr-xr-x. 1 root root 19476 Oct 15 2014 kdump -rwxr-xr-x. 1 root root 652 Jul 22 2014 killall -r-xr-xr-x. 1 root root 2134 Oct 15 2014 lvm2-lvMetad -r-xr-xr-x. 1 root root 2757 Oct 15 2014 lvm2-monitor -rwxr-xr-x. 1 root root 2571 Sep 4 2014 mdmonitor -rwxr-xr-x. 1 root root 2989 Jul 22 2014 netconsole -rwxr-xr-x. 1 root root 6064 Jul 22 2014 netfs -rwxr-xr-x. 1 root root 6334 Jul 22 2014 network -rwxr-xr-x. 1 root root 1923 Jul 15 2013 ntpd -rwxr-xr-x. 1 root root 2043 Jul 15 2013 ntpdate -rwxr-xr-x. 1 root root 3912 Feb 20 2014 postfix -rwxr-xr-x. 1 root root 1513 Sep 17 2013 rdisc -rwxr-xr-x. 1 root root 1822 Oct 15 2014 restorecond -rwxr-xr-x. 1 root root 2011 Aug 15 2013 rsyslog -rwxr-xr-x. 1 root root 1698 Oct 15 2014 sandBox -rwxr-xr-x. 1 root root 2056 Jun 23 2014 saslauthd -rwxr-xr-x. 1 root root 647 Jul 22 2014 single -rwxr-xr-x. 1 root root 4621 Oct 15 2014 sshd -rwxr-xr-x. 1 root root 2294 Oct 15 2014 udev-post |
/home | (User home directorIEs(optional)普通用户的家目录默认数据存放目录。 |
/lib | (Essential shared librarIEs and kernel modules)库文件存放目录 The /lib directory contains those shared library images needed to boot the system and run the commands in the root filesystem,IE.by binarIEs in /bin and /sbin [ [email protected] ~]# ls -ld /lib lrwxrwxrwx. 1 root root 7 Dec 12 12:36 /lib -> usr/lib [ [email protected] ~]# ls -ld /lib64 lrwxrwxrwx. 1 root root 9 Dec 12 12:36 /lib64 -> usr/lib64 |
/lost+found | 在ext3文件系统中,当系统意外崩溃或机器意外关机,会产生一些文件碎片在这里。当系统在开机启动的过程中fsck工具会检查这里,并修复已经损坏的文件系统。当系统发生问题,可能会有文件被移到这个目录中,可能需要手动的方式来修复,或移到文件原来的位置上 |
/mnt | (Mount point for mounting a filesystem temporarily)一般使用于临时挂载存储设备的挂载目录的,比如cdrom,U盘等目录。直接插入光驱无法使用,要先挂载后使用。 |
/opt(option) | (Add-on application software packages)表示的是可选择的意思,有些软件包也会被安装在这里,也就是自定义软件包,我们自己编译的软件包,就可以安装在这个目录中;通过源码包安装的软件,可以通过./configure –prefix=/opt/目录,非必须这样,视习惯或规范而定。 |
/proc | Kernel and process information virtual filesystem *** 纵系统运行时,进程信息及内核信息(比如cpu、硬盘分区、内存信息等)存放在这里。/proc目录伪装的文件系统proc的挂载目录,proc并不是真正的文件系统,它的定义可以参见/etc/fstab cat /proc/meminfo cat /proc/cpuinfo cat /proc/loadavg |
/sbin | (Essential system binarIEs)大多数是涉及系统管理的命令的存放,是超级权限用户root的可执行命令存放地,这个目录和/usr/sbin;/usrX11R6/sbin或/usr/local/sbin目录是相似的; Command Description fdisk ---->Partition table manipulator(optional) fsck ---->file system check and repair utility(optional) halt ---->Command to stop the system(optional) ifconfig ---->Configure a network interface(optional) init ---->Initial process(optional) mkfs ---->Command to build a filesystem(optional) mkfs.* ---->Command to build a specific filesystem(optional) mkswap ---->Command to set up a swap area(optional) reboot ---->Command to reboot the system(optional) route ---->IP routing table utility(optional) swapon ---->Enable paging and swapPing(optional) swapoff ---->disable paging and swapPing(optional) |
/tmp | (Temporary files)临时文件目录,有时用户运行程序的时候,会产生临时文件。/tmp就用来存放临时文件的,权限比较特殊。/usr/vat/tmp目录和这个目录相似。 |
/usr | (Secondary hIErarchy)这是个系统存放程序的目录,比如命令、帮助文件等。这个目录下有很多的文件和目录。当我们安装一个linux发行版官方提供的软件包时,大多数安装在这里。 /usr/bin ---->Most user commands用户可执行文件目录 /usr/include ---->header files included by C Programs程序的头文件存放目录 /usr/lib ---->librarIEs /usr/local ---->Local hIErarchy(empty after main installation) /usr/sbin ---->Non-vital system binarIEs /usr/share ---->Architecture-independent data /usr/share/Fonts---->字体目录 /usr/share/man---->帮助目录 /usr/share/doc---->文档目录 /usr/src:Source code(optional)源码目录 |
/var | (Variable data)这个目录的内容是经常变动的,看名字就知道,我们可以理解为vary的缩写,/var下有/var/log这是用来存放系统日志的目录,系统日志路径/var/log/messages。/var/www目录是定义Apache服务站点存放目录;/var/lib用来存放一些库文件,比如MysqL的,以及MysqL数据库的存放地; /var/log/messages ---->system messages from syslogd(系统日志文件) /var/log/secure ----> /var/spool/cron ---->定时任务的配置文件路径 |
以上是内存溢出为你收集整理的Linux各目录的意义全部内容,希望文章能够帮你解决Linux各目录的意义所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)