RHEL6 directory Structure of Linux

Source: Internet
Author: User
Tags time zones

http://www.linuxdiyf.com/viewarticle.php?id=204538

Why do you post this article? Because a lot of posted articles simply introduced the application of the directory, the deep understanding is not enough
--------------------------------------------------------------------------------------------------
[Date: 2010-12-28] Source: Linux Community Linux

Because the Linux kernel is free and free, so many people have developed Linux-based operating systems, and if everyone uses their own directory configuration method, it can lead to a lot of management problems. So, then there is the so-called FileSystem Hierarchy Standard (FHS) standards, it is released by the Linux Foundation Linux Standard specification, in order to achieve the world Linux Unified.

According to FHS's official documents, their primary goal is to allow users to understand that the installed software is usually placed in that directory, so they want independent software developers, operating system creators, and users who want to maintain the system to follow FHS standards. The focus of FHS is to standardize what data should be placed in each particular directory.

FHS defines the main file contents that should be stored in the main directory under/(root) [related to system boot], and also specifically defines/usr (Unix softwareresource) [related to software installation/execution] and/var (variable) [ The structure of the two directories and their subdirectories in relation to the system operation. This way, when we use a Linux system developed from different companies, you can quickly find the files you want somewhere.

The meaning and content of the root directory (/)

The root directory is the most important directory for the entire system, because not only are all directories derived from the root directory, but the root directory is also associated with actions such as boot/restore/system repair. Because the system requires specific power-on software, core files, power-on required programs, function libraries and other file data, if the system error occurs, the root directory must also include the ability to repair the file system. Because the root directory is so important, in terms of FHS requirements, he wants the root directory not to be placed in a very large partition, because the larger the partition, you will put more data, so that the root of the partition there may be more error opportunities.
Therefore, the FHS standard recommendation: The root directory (/) should be the smaller the partition should be the better, and the software installed by the application should not be placed in the same partition with the root directory, keep the root directory as small as possible. This is not only good performance, the root directory is located in the file system is not prone to problems.

So FHS defines the root directory (/) under which the presence of these secondary directories should be

The/bin system has a lot of directories for executing files, but/bin is more special. Because/bin stores commands that can be manipulated in single-player maintenance mode. Commands under/bin can be used by root and general accounts, mainly: Cat, chmod, chown, date, MV, mkdir, CP, BASH, etc.

/boot This directory is mainly used in the storage of files, including the Linux core files and boot menu and boot required configuration files and so on. Linux kernel commonly used file name: Vmlinuz, if you are using grub this boot manager, there will also be/boot/grub/this directory

/dev on Linux systems, any device and interface device is present in this directory in the form of a file. You simply access a device by accessing one of the files under the directory. More important documents than/dev/null,/dev/zero,/dev/tty,/dev/lp*,/dev/hd*,/dev/sd*, etc.

/etc system main configuration files are stored in this directory, such as the person's account password file, the start of various services and so on. In general, the file attributes in this directory are accessible to the general user, but only root has the power to modify it. The more important documents are:/etc/inittab,/etc/init.d/,/etc/modprobe.conf,/etc/x11/,/etc/fstab,/etc/sysconfig/and so on. In addition, the following important directories are:
/etc/init.d/: Is the pre-set startup script for all services here?
/etc/xinetd.d/: This is the profile directory of the various services that are called Super Daemon management?
/etc/x11/: Various configuration files related to x Window are here, especially xorg.conf this x Server configuration file.

/home This is the default user home directory for the system. When you add a general user account, the default home directory will be standardized here. More importantly, the home directory has two types of code: ~: Represents the current user's home directory
~dmtsai: Represents Dmtsai's Home directory

The/lib system has a much more functional library, while the/lib store is the library of functions that will be used when booting up, and
The function library that the command under/bin or/sbin will call. What is a function library? You can think of him as a "plug-in", some commands must have these [plug] to successfully complete the execution of the program. It is particularly important to/lib/modules/this directory, as it will store the core-related modules (drivers)

/media Media is the English language of [media], as the name implies, this/media is a removable device under storage. devices, including floppy disks, CDs, DVDs, and so on, are temporarily mounted here. Common filenames are:/media/floppy,/media/cdrom, and so on.

/mnt If you want to temporarily mount some additional devices, it is generally recommended that you store them in this directory. Earlier, this directory was used in the same way as/media, except that the directory was temporarily mounted after/media.

/opt This is the directory that is stored for third-party software. What is third-party software? For example, the KDE desktop Management system is a standalone program, but it can be installed on a Linux system, so KDE software is recommended to be stored in this directory. In addition, if you want to install additional software on your own (not provided by the original system), you can also install your software here. However, it is common for us to store it in the/usr/local directory.

/root the home directory of the system administrator (root). The reason for this is that if you go into single-player maintenance mode and only mount the root directory, that directory will be able to have the root home directory, so we would like Root home directory and root directory in the same partition.

/sbin Linux has a lot of commands to set up the system environment, these commands only root can use to [set] the system, the other users can only be used to [query] only. Placed under the/sbin for the boot process required, which includes the boot, repair, restore the system required commands. As for some server software programs, it is generally stored in/usr/sbin/. The system binaries generated by the natively installed software are stored in the/usr/local/sbin/. Common commands include: fdisk, fsck, Ifconfig, Init, MKFS, and so on.

/srv SRV can be regarded as the abbreviation of [service], which is the data directory to be used by some network services after they are started.

/tmp This is where the general user or the executing program temporarily stores the files. This directory is accessible to anyone, so you need to clean it up regularly. Of course, important data cannot be stored in this directory. Because FHS even suggested in the boot, should be the/TMP data are deleted, Rhel and CentOS is on the boot, empty content inside.

In fact FHS the criteria defined for the root directory are just the above. Of course FHS is only a reference, and each of the different distributions will have their own unique design. Let's take RHEL6 as an example and make a brief introduction.

/cgroup Rhel6 has prepared a new feature for the kernel: resource control. The package for this service is libcgroup. With this, you can allocate resources such as CPU time, system memory, network bandwidth, and so on. This is controlled by the Cgconfig service. If this service is not started, there will be no content in the Cgroup folder in the root directory. After you start the service, you will have some more content under the/cgroup directory. (Service Cgconfig Start/stop)

/selinux is the executable directory of Secure Enhance Linux (SELinux), which separates the services and systems independently so that the service is hacked so that the system's security is not affected.

/lost+found This directory is a directory that is generated using the standard EXT2/EXT3/EXT4 file system format in order to store some missing fragments in this directory when the file system has an error. This directory usually exists at the top level of the partition, for example, if you add a hard disk to/disk, it will automatically generate a directory under this system [/disk/lost+found]

/proc This directory itself is a virtual file system (Vsan filesystem), which he stores
Data is in memory, such as the system kernel, process information (processes), the state of peripheral devices, network status, and so on. Because the data in this directory is in memory, it does not account for any hard disk space. More important documents such as:/proc/cpuinfo,/PROC/DMA,/proc/interrupts,/proc/ioports,/proc/net/* and so on.

/sys This directory is very similar to/proc, but also a virtual file system, which is also a key to recording kernel-related information. This includes the currently loaded kernel modules and the hardware device information detected by the kernel, and so on. This directory also does not account for hard disk capacity.
It is also important to note that because the root directory is related to boot, only the root directory will be mounted during the boot process, and the other partitions will be mounted after the boot is complete. Therefore, in the root directory and the boot process related directory, it can not be placed with the root directory in different partitions, which directories can not be separated from the root directory?
/etc: Configuration file
/bin: Important Execution files
/dev: Required device files
/lib: Function libraries required to execute commands and modules required by the kernel
/sbin: Important System Execution files

The meaning and content of/usr
Many people will misunderstand/usr as user abbreviation, in fact, USR is the abbreviation of UNIX software resource, that is, the [UNIX operating system software resources] stored in the directory, rather than the user's data. FHS recommends that all software developers should place their data reasonably in the sub-directory under this directory, rather than building the software's own separate directory. This directory is a bit like the "C:\Windows\ + C:\Program files\" combination of Windows systems, which takes up the most hard disk capacity. In general, the sub-directory of/USR suggests the following:

/usr/bin/User-installed software-related command orders are here.

/usr/include/c/c++ (header) and the include file (include) in the program language, when we install some data in tarball Way (*.tar.gz), we use many of the included files inside.

The/usr/lib/contains the function libraries for each application, the object file, and executable files or scripts that are not commonly used by the general user. Some software provides special commands to set up the server, and these commands are not often operated by the system administrator, and are then placed in this directory.

/usr/local/system administrators install their own downloaded software on the machine, it is recommended to install to this directory, which will be easier to manage. The directory also has bin, etc, include, Lib ... 's Secondary directory.

/usr/sbin/system commands that are required for non-system normal operation. The most common are service commands (daemon) for some Web server software.

Where the/usr/share/stores the shared files, the data stored in this directory is almost always readable by the hardware architecture, because it is almost a text file. These secondary directories are common in this directory:? /usr/share/man: Online Help file?
/usr/share/doc: Software Miscellaneous file description? /usr/share/zoneinfo: Time zone files related to time zones

/usr/src/General source code is recommended to store here, Src has the meaning of source. The core source code is recommended to be stored in the/usr/src/linux/directory.

/usr/games Storing game files

/usr/x11r6/This directory is not available under RHEL6 (I installed the X Window System but not the directory).

/usr/libexec is also some library files, according to the name of the interpretation, may be executable file library.

The above two directories, I also do not know very much, so hope not to mislead everyone. Colleagues, you know the details, please give me a message, thank you.

The meaning and content of/var
If/usr is a directory that occupies a larger hard disk capacity during installation,/var is a directory that will gradually take up hard disk capacity after the system is running. Because the/var directory is primarily for files with normal changes, including cache, login files (log file), and files generated by some software operations, including program files (lock file, run file), and so on. Common sub-directories are:
/var/cache/Some temporary archives that will occur during the operation of the application itself;

The/var/lib/program itself executes the process that needs to be used to store the data files in the directory. Under this directory, each
The software should have its own directory. For example, the MySQL database is stored in/var/lib/mysql/and the RPM database is put into/var/lib/rpm.

/var/lock/some devices or file resources can only be used by one application at a time, and if there are two programs using the device, there may be some error conditions, so the device must be locked (lock) to ensure that the device will only be used for a single software. For example, the recorder is burning a disc, do you think, there will be two people at the same time using a burner burning tablets? If two people were recording at the same time, whose information was written in that film? So when the first person is burning the burner will be locked and the second person will have to be unlocked (that is, the previous person ran out) to continue using it.

/var/log/is a very important directory! This is the directory where the log files are stored. Inside more important documents such as/var/log/messages,/var/log/wtmp (log the user's information) and so on.

/var/mail/stores the directory of personal e-mail mailboxes, but this directory is also stored in the/var/spool/mail/directory. These two directories are linked files to each other.

/var/run/Some programs or services are started, their PID will be stored in this directory.

/var/spool/This directory usually holds some queue data, so-called queues are queued to wait for other programs to use the data. This data is usually deleted after it is used. For example, the system receives a new letter that will be deposited in/var/spool/mail/, but the letter will be deleted in principle after the user has received the letter. If the letter is not sent out temporarily, it will be put into the/var/spool/mqueue/, and then deleted after being sent out. If it is a scheduled task (crontab), it will be stored in the/var/spool/cron/directory.
Some of the other documents are in our own knowledge.

The meaning and content of/proc
/proc it does not exist on disk, the kernel creates it in memory and it is used to provide information about the system.

/proc/number each process has a directory with its process number name under/proc.

/proc/cpuinfo information about the processor, such as its type, date of manufacture, model number, and performance.

/proc/devices the list of device drivers that are configured into the currently running kernel.

/proc/meminfo information about physical memory and swap usage.

/proc/modules which kernel modules are loaded at this time.

/proc/net status information for the network protocol.

/proc/uptime the time the system started.

/proc/version kernel version.

Although the above documents are basically easy-to-read text files, the format of these files may sometimes be difficult to understand. There are many commands that simply read into the above file and format it in a format that facilitates understanding. For example, the free program reads the/proc/meminfo information and converts the number of bytes into thousands of bytes (and also adds a small amount of information).


++++++++++++++++++

Related comments
Author: wei9011205132 Release date: 2011-7-15
Look
Author: lcy1216 Release date: 2011-7-15
More detailed study of
Author: Campus Release date: 2011-7-15
Strong stickers Must See
Author: Age Release Date: 2011-7-16
/selinux is also virtual, and/proc is the same

Read (605) | Comments (0) | Forwards (0) |0

Previous: CentOS officially released CentOS 6

Next: Linux kernel ushered in 3.0 times more practical than surprises

Related Popular articles
    • Common Linux Service ports
    • Xmanager 2.0 for Linux configuration
    • "Rootfs build" BusyBox httpd ...
    • OpenWrt in Luci study notes
    • What is a shell?
    • Linux DHCP Peizhi ROC
    • Soft links to Unix files
    • What does this command mean, I'm new ...
    • What does sed-e "/grep/d" mean ...
    • Who can help me solve Linux 2.6 10 ...
Leave something to the owner! ~~ Comment on the hot topic

RHEL6 directory Structure of Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.