Introduction to the three types of Linux link files

  

Summary: symlinks (symbolic links) refer to file names, hardlinks (hard links) refer to meta-data (metadata), and reflinks (reference links) directly reference data.

The three different link file types on Linux point to three different components of the file. That is, the file name (stored in the directory), the metadata (stored in the inode), and the data block (the data itself). The following shows the relationship between files and various types of linked files.

name2 – symlink –> name1 – hardlink –> inode1 – reflink —> dataname3 – hardlink -///name4 – hardlink –> inode2 —reflink - /

Speak less, then use the actual application to analyze the various link types and how to use them. First we create a file. Linux has a command to create in N, such as echo > file ^_^.

1. Symbolic links

cp –symbolic-link name1 name2

Symbolic links are similar to shortcuts under Windows, an alias.

Second, hard link

cp –link name1 name3

In fact, all ordinary files under Linux will be hard-linked to an inode. This means that each time you create a hard link, one more file points to the same inode. In fact, this is very useful for system backup ^_^.

Three, reference links

cp –reflink name1 name4

To be honest, this author has not used it, similar to hard links. It only takes up less storage space.

Copyright © Windows knowledge All Rights Reserved