Centos root directory structure and the various structures introduced

  • /: Root directory, in general, only the root storage directory, do not store the file, / etc, / bin, / dev, / lib, / sbin should be placed in the root directory of a partition
  • / Bin: / usr / bin: executable binary files directory, commonly used commands such as ls, tar, mv, cat and so on.
  • / Boot: put some files used when starting linux system. / Boot / vmlinuz for the linux kernel file, and / boot / gurb. It recommended a separate partition, partition size to 100M
  • / Dev: file storage device linux system, access a file in the directory, which is equivalent to access a device commonly used to mount the CD mount / dev / cdrom / mnt.
  • / Etc: system configuration files directory is not recommended to store executable files in this directory, it is important configuration files have /etc/inittab,/etc/fstab,/etc/init.d,/etc/X11,/etc remember before the backup /sysconfig,/etc/xinetd.d modify the configuration file. Note: / etc / X11 store associated with the x windows settings.
  • / Home: the default user's home directory, create a new user account, the user's home directory are stored in this directory, ~ represents the current user's home directory, ~ test represents the home directory of the user test. It recommended a separate partition, and a larger set of disk space to store user data
  • Need help library when the library system directory, the program in the implementation process, you need to call some additional parameters, the more important directory is / lib /: / lib: / usr / lib: / usr / local / lib modules.
  • / Lost + fount: the system generates an error exception, will lose some of this fragment is placed under the directory, usually this directory will automatically appear in the directory means. The load in the hard disk / disk in this directory will be automatically generated directory / disk / lost + found / mnt: / media: default disc mount point, usually mounted on the disc
  • At / mnt / cdrom, not necessarily, be mounted at any position can be selected.
  • / Opt: to host an additional install the software place the directory. Such as: Fedora community development software FC4 use, if you want to install their own new KDE desktop software, you can install the software in the directory. Previous Linux system, used to be placed in the / usr / local directory
  • / Proc: The data in this catalog are in memory, such as system core, peripherals, network status, since the data are stored in memory, so do not take up disk space, the more important directories have / proc / cpuinfo, / proc / interrupts , / proc / dma, / proc / ioports, / proc / net / * etc.
  • / Root: system administrator root's home directory, the system first boot partition for /, so it is best to / root and / placed under a partition.
  • / Sbin: / usr / sbin: / usr / local / sbin: placing executable commands used by the system administrator, such as fdisk, shutdown, mount the like. And / bin difference is that these directories are commands to the system administrator root to use, the average user can only "see" and can not set up and use.
  • / Tmp: general user or program being executed temporary storage directory files, anyone can access the important data can not be placed in this directory
  • / Srv: the service started need to access the data directory, Web services need to access data such as www stored in srv / in the / www
  • / Usr: application storage directory,
  1. / Usr / bin storage applications,
  2. / Usr / share shared data store,
  3. / Usr / lib store can not be run directly, but some library files necessary to run many programs
  4. / Usr / local: storage software upgrade package. / Usr / share / doc: system description file storage directory.
  5. / Usr / share / man: the program documentation storage directory, the query will use man ls content /usr/share/man/man1/ls.1.gz suggestions separate partition, set a large disk space
  • / Var: during the execution of placement systems frequently changing files, log files, such as to change the / var / log, / var / log / message: All of the log file storage directory, / var / spool / mail: e-mail stored in the directory, / var / run: after the program or service is started, its PID is stored in the directory. Recommended a separate partition, set a large disk space

 

 

/ Dev: directory  

  • dev is the device (device) abbreviation. / Dev directory are very important for all users. Because it contains all the external devices Linux system used in this catalog. But there is not an external device drivers put, this and windows, dos operating system is not the same. It is actually one of these ports external device access. We can easily to access these external devices, and access a file, a directory without any distinction.  
  • Linux Unix followed the style, all equipment is recognized as a file. The device is divided into two files: File block device (b) and the character device file (C), the device is generally stored in a file / dev directory, file for the common device will be explained:  
  • / Dev / hd [at]: IDE device / dev / sd [az]: SCSI device / dev / fd [0-7]: standard floppy / dev / md [0-31]: Soft raid devices / dev / loop [ 0-7]: the local loop equipment / dev / ram [0-15]: memory / dev / null: Unlimited data reception apparatus, corresponding to the black hole / dev / zero: Unlimited zero resource / dev / tty [0-63]: virtual terminal / dev / ttyS [0-3]: serial / dev / lp [0-3]: parallel / dev / console: console / dev / fb [0-31]: framebuffer / dev / cdrom => / dev / hdc / dev / modem => / dev / ttyS [0-9] / dev / pilot => / dev / ttyS [0-9] / dev / random: nonce device / dev / urandom: device random number (PS : random number of devices, back I will write blog articles summarize) node under the / dev directory is created devf or how udev will automatically help you create too?. kobject sysfs file system is the basis of, udev to get the newly created device by monitoring, detecting sysfs.

/ Etc: directory  

Contains many files. Many network configuration files are in / etc. / Etc / rc or /etc/rc.d or /etc/rc*.d   

Start, or change scripts or scripts that run when the run-level directory ./etc/passwd user database, which gives the user the domain name, real name, home directory, encrypted password and other user information. / Etc / fstab start mount -a command (in / etc / rc or equivalent startup file) automatically mount system list file under Linux, also comprises information ./etc/group swapon -a similar swap area enabled / etc / passwd, but noted that instead of the user group. / etc / inittab init configuration file. / etc / issue getty output information before the login prompt usually include a short description of the system or welcome information from the content management system members determine. / etc / motd message of the Day, automatically output after a successful login. content determined by the system administrator. often used to advertise information, such as the planned shutdown time of the warning. / etc systems list / mtab currently installed file by the initialization scripts, automatically updated by the mount command. in case you need a list of currently installed file system, such as the df command. / etc / shadow in the shadow password software installed on your system Sub password file. Shadow password encrypted password file / etc / passwd file is moved to the / etc / shadow, whereas the latter only readable by the root. This makes it more difficult to decipher the password. /Etc/login.defs login command configuration file. / etc / printcap similar to the / etc / termcap, but for the printer. different syntax. / etc / profile, /etc/csh.login, Bourne when /etc/csh.cshrc login or startup file or C shells execution. this It allows the system administrator to establish global default environment for all users. / etc / securetty confirm the safety terminal, which terminal that is allowed to log in as root. generally only lists the virtual console, so it is impossible (at least very difficult) to break through a modem or network into the system and get superuser privileges. / etc / shells list of trusted shell.

proc: filename directory

Contents of the file / proc-related parameters / cmdline load the kernel issued! Check out this file, you can understand how the system is started! Information of the CPU / proc / cpuinfo the machine, including the clock, and the type of operation function / proc / devices This file records the main device code every major device system, and mknod about it! / Proc / filesystems current system has been mounted filesystem Lo! / Proc / interrupts the current state of the system above IRQ assignment. / Proc / ioports currently arranged above each device system I / O addresses. / Proc / kcore this is the size of the memory of it! A big right! But he do not read it! / Proc / loadavg remember the top and uptime, right? Yes! The average value of the top three is recorded here! / Proc / meminfo memory usage information listed free, hey! Here it is possible to SEE! / Proc / modules currently loaded our Linux has a list of modules can also be thought of as a driver for it! / Proc / mounts data system has been mounted, the call is out of this with the mount command data it! / Proc / swaps linked to the system in the end where the loaded memory? Ha ha! Use out partition on record in this matter! / Proc / partitions using fdisk -l will all current partition, right? In this document which is also a record Oh! / Proc / pci PCI bus in the above, the details of each device! Lspci can be used to look up! / Proc uptime is to use the information when uptime, there will be a / it! / Proc / version kernel version, it is the content displayed using uname -a! / Proc / bus / * number of bus devices, as well as U disk device is also recorded in this oh!

/ Usr: directory  

/ Usr filesystem is often large, since all programs installed here / usr all files in general from the Linux distribution;.. Locally installed programs and other stuff under / usr / local so can new system or upgrade when a new distribution no need to reinstall all programs ./usr/etc stored settings file / usr / games store games and teaching files / usr / include is for C header files development tools / usr / share independent data storage structure of / usr / bin almost all user commands some commands in / bin or / usr / local / bin in the root file system ./usr/sbin unnecessary system management commands, such as most services programs. / usr / share / man, / usr / share / info, / usr / share / doc Manual pages, GNU information documents, and a variety of other document files. / usr / include C programming language header file. for consistency this should actually be in / usr / lib, but supports the name traditionally ./ . usr / lib program or subsystems of the same data files, including some site-wide configuration file name lib comes from library (library);. programming raw inventory / usr / local software locally installed in / usr / lib Lane Other files placed here. / Usr / src store the program's source code

/ Var:. Directory / var runtime system generally includes data to be changed is specified for each system, that is not shared with other computers via a network / var / catman man when cache.man page when the page formatting requirements. there is generally a source file / usr / man / man * in; some man page may have pre-formatted version, there is / usr / man / cat * and the other man in the page when you first see the need to format, format. the complete version of the presence / var / man in, so that others do not need to wait for formatting the look when the same page. (/ var / catman is often clear, as clear as the temporary directory.) / var / lib normal system to change the run-time files. / var / local / usr / variable data program (ie, the system administrator to install the program). Note, local installed, if necessary, even locally installed programs should use the other / var directory , such as / var / lock. / var / lock lock file. many programs follow a lock file in / var / lock in the agreement, to support that they are using a particular device or file. other programs will notice the lock file I will not attempt to use this Log file backup or file. / Var / log various programs, especially login (/ var / log / wtmp log all login and logout to the system) and syslog (/ var / log / messages in all core storage systems and procedures information. / var / log where files are often grow indefinitely, should periodically clear the save / var / run to useful information about the file system before the next boot. For example, / var / run / utmp contains the user currently logged on information ./var/spool mail, news, print queues, and other queued work. each different spool has its own subdirectory in / var / spool, for example, the user's mailbox in / var / spool / mail in . / var / tmp over / tmp to allow or require the presence of a large temporary files a long time. (Although the system administrator might not allow / var / tmp has a very old file.)

More important directory

In the Linux system, there are several directories is important to note, here are a few to note directory, and default-related purposes: 

  • / Etc: this directory Xiangdangzhongyao, as mentioned earlier, you boot the system data files are under this directory, so when the catalog is damaged, then your system is probably also the almost dead! And in the next file, you will find that we often use /etc/rc.d/init.d this subdirectory under this directory, because the init.d subdirectory is open scripts Some Linux system services (you can think as a batch file) in place. In this /etc/rc.d/rc.local file is executable boot. 
  • / Bin, / sbin, / usr / bin, / usr / sbin: This is the system default directory to place executable file, for example userconf root is often used, netconf, perl, gcc, c ++, etc. The data on this several directories, so if you can not find an executable file at the prompt characters, you can look it up in the four directory! Which, / bin, / usr / bin is the instruction to the system used by the user, and / sbin, / usr / sbin is the command for system administrators!  
  • / Usr / local: This is the system default installation directory allows you to you later upgrade kit. For example, when you find an updated Web packages (such as Apache) can be installed, and you do not want to rpm way to upgrade your kit, then you can apache install this package under the / usr / local. Installed here has the advantage, because the current system we are similar, so if you let someone else take over the system, it is relatively easy to use it! Also relatively easy to find the data to Oh! So, if you need it, I usually will / usr / local / bin is added to this path in my path. 
  • / Home: This is a system where there will be the home directory of the population account settings.  
  • / Var: The path to important! Look at where the issue of whether it is recorded at the time of login, all kinds of service problems, and the normality of the service records, etc. of recorded catalog, so when your system has problems, we need to record this directory file data in Hello ! The pre-placement mail is also here, so he is very important  
  • / Usr / share / man, / usr / local / man: This directory is placed two kinds of kits illustrate local files, for example, if you execute man man, then the system will automatically find all the documentation in both directories

File Type:

  • After talking over file format, come to talk about the so-called document type it! We mentioned in the property description just in front of the sign (d or -) can represent a directory or file, it is a different kind of file it! Linux file under the main types of these types:
  • Regular files (regular file): is the general type of the file, in terms of attributes by the ls -al displayed by the first property [-]. In addition, in accordance with the contents of the file, and it can be roughly divided into two types of documents:
  • Text files (ascii): This is one of the most Unix systems Hello, almost as long as we can use to set all files belong to this one;
  • Binary (binary): in addition to normally executable scripts (batch files Text), which is a file format;
  • Directory (directory): is the directory! The first property is [D];
  • Link file (link): is similar to Windows shortcuts underneath it! The first property is [L];
  • Device files (device): some documents related to the system around, usually concentrated in the under / dev directory! Usually divided into two types:
  • Block (block) device files: that some data is stored, the interface device to provide access to the system, it simply means that the hard disk! For example, your code is number one hard drive / dev / hda1, etc. files it! The first property is [B];
  • Character (Character) device files: That is the number of serial port interface device, such as a keyboard, mouse, etc.! The first property is [c].

 

Linux file system (inode):  

Among Linux system, every file has more than the contents of the data file, also includes the various attributes of the file, for example: their group, belongs to the user, the ability to execute, file creation time, file attributes, and so special. We'll contents of each file is divided into two parts store, it is a properties file, the other is the content of the file. 

To cope with these two different pound, so the planning ext2 file inode and Block to store each attribute (in which inode) and the file contents (placing them in Block Area). When we want a partition formatting (format) is ext2, it is necessary to specify the size of the inode and Block for the job, that is, when the partition is formatted as ext2 file system, and he must have inode table block area of ​​these two regions. 

Block has been said earlier, he is the smallest unit of data storage. So what inode that? ! Simply put, Block is recording "data file contents" of the region, as the inode is a record, "the relevant properties of the file, and the file contents placed in which Block of" information. Simply put, inode file in addition to property records, but also must have the function point (pointer), that point to place the contents of the file into blocks, so the operating system can obtain the correct contents of the file

  • With a group owner of the file (owner / group);
  • The file access mode; type of the file;
  • Creation date of the file (ctime), the last read time (atime), last modification time (mtime);
  • The capacity of the file; characteristic definition file flag (flag), as SetUID ...;
  • The document points to the real content (pointer);

Guess you like

Origin www.cnblogs.com/Jesse-Li/p/10942500.html