Linux directory structure and file properties management

ioeinternet 22/09/2021 1846

Can know how the Linux file is saved, and the role of the i node

What kind of can you tell the link?

Can know what timestamp

Can tell what orders in directory management

Linux file save, data metadata file name

i node introduction

Link introduction

Timestamp

Common directory management command introduction

1. File storage in linux

If a user edited a file in the Linux system, after editing the content, when the editor is turned off, I will ask the user to change this file. After setting the name, select a directory to save the file to the specified directory, in this The example contains three components related to files in the Linux system.

Data: It is the content of the file, saved in a structure called DATA (data block)

Metadata: Save system data for the feature of a file, is used to save information related to file content and file names, such as the creation of files, date, size, etc., save in one called inode (i node) The structure is in the structure.

File Name: Used to save the file name, the file name is saved in a structure called Dentry.

二、i node introduction

Through the previous course, we know that inode is the metadata used to save the file, and save the file-related property information, such as the number of links, etc. We look at the inode information of the specified file by similar to the statune.txt.

三、Link introduction

If the user wants to save the same file in two places, or use two different file names, there is another choice other than replication, which is the link, and is divided into hard links in the Linux system. Link, empty link, recursive link, etc.

Hard link: Allow a file to have multiple valid path names, so that the user can establish a hard chain to receive important files to prevent "accidentally deleting" source data, but hard links can only connect between files in the same file system.

Soft link: also called the symbolic link, similar to the shortcut in the Windows system, different from the hard link, soft link is a normal file, soft link can be created for files or directories.

This is a conceptual description, we use a sentence to summarize these two links, hard links cannot be chained, can not cross file system, soft links can be; source file delete soft links fail, hard links are still available, we pass The following example can see the creation of hard links and soft links and the basic contrast

In addition to the hard links we said, there are hard links and soft links.

Empty link, the so-called empty link is that the source file pointed to by the soft link does not exist, including the source file being deleted, and the name is changed.

Recursive link: Recursive link is not as good as empty links, if you want to see, you can do it almost specifically, if the user creates two soft links, Linka is associated with the linkb, while LinkB is associated with linka, this time, recursive links, such as

Absolute soft links and relative soft links: Mainly refer to the user when creating a soft link is an absolute path or relative path to specify a link target, if the link is created, then the two methods can be used freely, But if the link file needs to be moved, it is recommended to use an absolute path, such as

Four, Timestamp

Timestamp refers to the total number of milliseconds from 00: 00: 00, 01 January 1970, Greenwich Mean Time (08: 00: 00, 01 January 1970, Beijing Time) to the present. In layman's terms, Timestamp is a complete verifiable data that can indicate that a piece of data already exists at a specific point in time. It is mainly proposed to provide users with an electronic evidence to prove the time when certain data of the user was generated. When we use the stat command to view the file, in addition to the creation time, you will find three information related to Timestamp

Abbreviation command

Atime Access Time File Data is updated after reading

CTIME change time file I-node information is updated each time it is changed

Mtime modification time file data is changed each time after changing updates

五、Common directory management command introduction

to sum up

We introduced this section.

File save

i node

link

Timestamp

Directory Management Common Order

Latest: Chen Yougu is a generation of Xiong, soldiers strong horse, why didn't Zhu Yuanzhang?

Next: American Guangming is a 14th National Federation, is it necessary to work with Russia?