Introduction to Linux File system

Source: Internet
Author: User

we usually say that under Linux, everything is file. It goes without saying that Linux must be supported by a powerful file system. In fact, no matter what system, need a set of file system to store files. Because of the computer, they can only read binary files, but for people, reading binary files is very difficult, it needs to convert the adult can read the file form, stored in the file system. In general, files that are transferred into memory are files to be executed, which are written to the file system after execution is complete. We know that CPU execution speed is very fast, the speed of file access is far from the speed of CPU execution, so there is a register, cache, memory, disk concept. In general, the faster the component is closer to the CPU, the more expensive it is, the fastest integration of registers inside the CPU, followed by the cache, and then the memory. According to the natural development of the rules, any material is not perfect, the above media is the same, at the same time, they do not have power-off storage function, so, after the power outage, the information in these media will disappear. That is, there is a need for specialized media to store the information in memory, the disk is to carry this function, the information on the disk, the power is not lost, so all the files on the computer are stored on the disk, then the file system is installed on the disk. When we install the operating system, we have a mount process, choose a good mount point, after we click OK, prompt to delete the disk information, in fact, is the process of installing the file system, after the installation of the file system, all files stored in the file system can be recognized by the operating system. Let's look at the following picture: The image is a reference

The listed directory is a structure diagram of a Linux system, which is a tree-like chart. Why use tree-level structure diagram? Because the tree-like structure is easy to classify and organize, like a library of books, first carry out large categories into different bookshelves, in the progressive subdivision, convenient file search. We know that in Windows, there is the concept of C-disk, D-disk and so on, in fact, they have a file system installed on each disk, which means that each partition is independent. After Windows graphics the operating system, it simplifies the concept of the path, in fact, every access to a folder, there is a path behind the run. Linux generally in the room does not provide display, we do not need to run a graphical interface to waste resources, then we access the file when we need to enter the path to find files, in fact, the same essence. The following is a description of the file classification under Linux files:

/   根目录,也是进入文件系统的点;/boot   系统引导启动时要加载的静态文件,内核,grub等;/bin   系统自身启动和运行时可能会用到的核心二进制程序,不能关联至独立分区;/sbin   管理类基本命令,不能关联至独立分区,系统启动时需要;/lib    基本共享库文件,内核模块文件;/lib64  64位系统辅助共享库文件存放位置;/etc  大多数应用程序的配置文件的集中存放位置;/home  普通用户的家目录的存放位置;/root   管理员root的主目录;/media 便携式设备挂载点;/dev   设备文件及特殊文件存放位置;/opt   第三方应用程序存放位置;/usr  UNIX操作系统软件资源存放位置;/var   经常发生变化的文件的存放位置;/selinux  相关安全策略等信息的存放位置   等其他目录。

The above basically lists most of the files in the Linux system, and some unimportant files are not listed.
What if the system crashes and the system needs to be reinstalled, but our data doesn't want to be lost? This requires the concept of the mount that we have mentioned, which is similar to putting the directory alone, not all in the root directory. The root directory is like our C drive, we only choose the format root when reloading the system, the other mount points do not move, so that we can not restore the other data, after reloading can see the previous data. Linux and Windows are two concepts that, while not comparable, can be compared to learning, which helps us understand and learn the operating system.

After reading the file system under Linux, let's look at the main file types under Linux.
We know that under the Linux command, the LS command is used to display the directory file, Ls-l is used to long list the file system, in order to facilitate long list, the system defines an alias (alias command), LL can replace the Ls-l command, is also a long list of files. As follows:

We can see the alias information in the current system, below we list a directory under a file:

The first column that the red arrow points to is the permission column we see, which is usually divided into 10 bits, the first of which is the type used to mark the file, and the permission bit behind it.
Typically, the following information appears on the first bit:

-(f):普通文件d:目录文件b:块设备c:字符文件l:符号链接文件p:管道文件s:套接字文件,socket

We can then go through the direct long list to see the file type.

Introduction to Linux File system

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.