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/02 Report--
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 *?
< . ; & ! { } | \ ' '" ` ( ) { } 等字符不能在文件名中存在。 4、目录配置依据(FHS) 由于Linux开源,为了保证规范,Linux逐渐形成了的软件开发商、操作系统制作者、以及想要维护系统的使者,都能够遵循的目标配置依据FHS(文件系统层次化标准). 事实上,FHS针对目录树架构仅定义出三层目录下面应该放置什么数据而已,分别是: / (root, 根目录):与开机系统有关; 根目录是整个系统最重要的一个目录,因为不但所有的目录都是由根目录衍生出来的,同时根目录也与开机/还原/系统修复等动作有关。 由于系统开机时需要特定的开机软件、核心文件、开机所需程序、函数库等等文件数据,若系统出现错误时,根目录也必须要包含有能够修复文件系统的程序才行。 因为根目录是这么的重要,所以在FHS的要求方面,他希望根目录不要放在非常大的分区内, 因为越大的分区你会放入越多的数据,如此一来根目录所在分区就可能会有较多发生错误的机会。因此FHS标准建议:根目录(/)所在分区应该越小越好, 且应用程序所安装的软件最好不要与根目录放在同一个分区内,保持根目录越小越好。 如此不但性能较佳,根目录所在的文件系统也较不容易发生问题。 /usr (unix software resource):与软件安装/执行有关; /var (variable):与系统运行过程有关。 根目录(/)FHS要求必须要存在的目录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.
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.