In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
This paper takes the linux CentOS operating system as an example to analyze the files and directories of the root directory of the linux CentOS system. Reading the complete article, I believe you have a certain understanding of the files and directories of CentOS.
Linux uses a tree-like directory structure to organize files, simply placing subdirectories and files in a directory, where subdirectories and files can continue to be placed, and so on, like branches of a tree. The starting point of this file structure of Linux is the "root directory", that is, "/", which is the starting point of all files. FHS (File system hierarchy Standard) defines the main directory under the root directory and the files that should be placed within each directory. Note that in Linux, "file" is a very broad concept, and everything is a file. So whether it is a directory or a device, it is a file, or as long as it is visible in the system, it is a file.
I. File type
Users can display file types through the "ls-al directory". The file type is determined by ls-al displaying the first character of each file or directory information on each line.
The first character is [d], which represents a directory.
The first character is [-], which represents a file.
The name is. , which represents the current directory; is.., and represents the directory one level above the current directory (this is the same as Windows)
The name of the file is. To start, A. bash_logout stands for a hidden file or directory, as shown in the following figure.
Compared with files under Windows, the file types of Linux include the following files in addition to regular files (plain text files, binary files, data files, etc.):
Enter the command ls-al / dev (show details of all files under / dev)
Block device file: the first attribute character is [b], which generally represents some storage devices. For example, sda represents the first SATA or SCSI hard drive, and hda represents the first IDE hard drive.
Character device file: the first attribute character is [c], which is usually the interface device of some serial port, such as mouse and keyboard.
Link file: the first file whose attribute character is [l], which is divided into soft link and hard link.
Data interface file: the first attribute character is [s]. This type of file is usually used to exchange data on the network.
(enter the command ls-al / run | grep ^ s
Data transfer file (FIFO,pipe): a special file type that is mainly used to solve errors caused by multiple programs reading and writing a file at the same time. FIFO is an abbreviation for first-in, first-out (first in first out), or pipe.
2. File extension
Basically, Linux doesn't have the concept of an extension, which is very different from Windows. Under Windows, .com .exe. Bat usually represents executable files, as well as .dll and other types of files. But under Linux, whether a file can be executed or not is mainly determined by two aspects: one is whether its content is executable code, and the other is whether the user has executable permission. It has nothing to do with whether it has an extension or why.
Of course, Linux also distinguishes some special types of files by some specific extensions.
* .sh: represents a script or batch file
* .Z tar.gz. Tar *. Zip * .tga: represents a packaged compressed file
* .html * .php: Web page file.
3. Restrictions on file names
The maximum allowable file name for a single file or directory is 255 characters, the maximum length of English is 255 characters, and the maximum length of Chinese characters is about 128.
Because some special characters have special meaning in command mode, so *? <. Characters such as; &! {} |\'"`() {} cannot exist in the file name.
4. Directory configuration basis (FHS)
Because Linux is open source, in order to ensure the specification, Linux has gradually formed software developers, operating system makers, and messengers who want to maintain the system, all of which can be configured according to FHS (File system hierarchy Standard).
In fact, FHS only defines what data should be placed under the three-tier directory for the directory tree architecture, which are:
/ (root, root directory): related to boot system
The root directory is the most important directory in the whole system, because not only all directories are derived from the root directory, but also related to boot / restore / system repair actions. Because the system needs specific boot software, core files, programs needed to boot, function libraries and other file data, if there is an error in the system, the root directory must also contain programs that can repair the file system. Because the root directory is so important, in terms of FHS's requirements, he hopes that the root directory will not be placed in a very large partition, because the larger the partition, the more data you will put in, so there may be more opportunities for errors in the partition where the root directory is located. Therefore, the FHS standard recommends that the partition of the root directory (/) should be as small as possible, and the software installed by the application should not be placed in the same partition as the root directory, and keep the root directory as small as possible. In this way, not only the performance is better, but also the file system where the root directory is located is less prone to problems.
/ usr (unix software resource): related to software installation / execution
/ var (variable): related to the running process of the system.
Root directory (/) directories that FHS requires must exist
Root directory (/) FHS suggested directories that can exist
/ home: is the default consumer home folder (home directory) of the system. When the user adds a general user account, the default user home folder will be regulated here. More importantly, the home folder has two code names: ~: represents the current user's home folder ~ fromheart: represents the fromheart's home folder.
/ lib: a binary function library used to store a format different from / lib, such as / lib64 library that supports 64-bit
/ root: home folder of the system administrator (root). The reason for putting it here is that if you enter single-user maintenance mode and mount only the root directory, the directory can have the home folder of root, so users will want the home folder of root to be placed in the same partition as the root directory.
Directories that must exist for FHS under / usr/
/ usr/bin/: all the instructions that the average user can use are put here! At present, the new CentOS 7 has placed all the user instructions here, and link / bin here using linked files! In other words, / usr/bin is exactly the same as / bin! In addition, FHS requires that there should be no subdirectories in this directory.
/ usr/lib/: is basically the same as / lib, so / lib is linked to this directory.
/ usr/local/: system administrators install their own downloaded software on this machine (not the default provider of distribution). It is recommended to install it to this directory, which will be easier to manage.
/ usr/sbin/: is not a system instruction required for the normal operation of the system. The most common is the service instruction (daemon) of some web server software, but the basic function is similar to / sbin, so / sbin is currently linked to this directory.
/ usr/share/: mainly places data files of read-only architecture, including shared files, of course. The data placed in this directory is almost readable regardless of hardware architecture, because it is almost all text files, and these subdirectories are common in this directory: / usr/share/man: online documentation; / usr/share/doc: software miscellaneous file description / usr/share/zoneinfo: time zone file related to time zone
Directories where FHS is recommended to exist under / usr
/ usr/games/: the place where the data related to the game is placed.
Files in programming languages such as / usr/include/:c/c++.
/ usr/libexec/: some executable files or scripts (script) that are not commonly used by ordinary users, and so on, will be placed in this directory. For example, most of the operation instructions under the X window are placed in this directory.
/ usr/lib/: has the same function as / lib/, so / lib is currently linked to this directory.
/ usr/src/: general source code is recommended to be placed here. As for the core source code, it is recommended to place it in the / usr/src/linux/ directory.
Directories that must exist for FHS under / var/
Some scratch disks that will be generated during the running of the / var/cache/: application itself
The directory where the data files need to be used during the execution of the / var/lib/: program itself. In this directory, each software should have its own directory. For example, MySQL's database is placed in / var/lib/mysql/ and rpm's database is placed in / var/lib/rpm!
/ var/lock/: some devices or file resources can only be used by one application at a time, and if two programs use the device at the same time, some error conditions may occur, so you have to lock the device to ensure that the device is only used by a single software.
/ var/log/: log file directory, in which the more important files such as / var/log/messages, / var/log/wtmp (recording the information of the login) and so on.
/ var/mail/: places your personal email address in the directory, but this directory is also placed in the / var/spool/mail/ directory! Usually these two directories are linked files to each other.
/ var/run/: when some programs or services start, they place their PID in this directory. Same as / run, this directory is linked to / run!
The / var/spool/: directory usually places some queue data.
Other important catalogues
/ lost+found: this directory is created using the standard ext2/ext3/ext4 file system format to place missing fragments in this directory when there is an error in the file system. However, if you are using the xfs file system, this directory will not exist!
/ proc: this directory itself is a "virtual file system (virtual filesystem)". The data he places is in memory, such as system core, itinerary information (process), status of peripherals and network status, and so on. Because the data in this directory is in memory, it doesn't take up any hard disk space. More important files such as / proc/cpuinfo, / proc/dma,/proc/interrupts, / proc/ioports, / proc/net/*, and so on.
/ sys: this directory is actually very similar to / proc. It is also a virtual file system, which mainly records information related to the core and system hardware information. It includes the loaded core modules and the hardware equipment information detected by the core, and so on. This directory also does not take up hard disk capacity.
This is the end of the description of CentOS files and directories. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.