Linux Basics Three--how much does a linked file know?

Source: Internet
Author: User

As is known to all, in the Windows environment we have already seen the link file, machine we usually use shortcuts.

in fact, in Linux we can see the following two types of link files

A. Hard-link files

Create command: LN [source file] [target file]

A hard link is an actual link.

Remember we talked about what is called the inode, then we come to understand a 650) this.width=650; "Title=" Foundation 31. PNG "alt=" Wkiom1csnbszjirjaaddxjqgd7g638.png "src=" http://s1.51cto.com/wyfs02/M00/7F/C8/ Wkiom1csnbszjirjaaddxjqgd7g638.png "/>
The meaning of this is: security. If you accidentally delete one of the file names then you can also find this source file through other files

And if you modify a file, other files will be modified as well.

650) this.width=650; "Title=" Foundation 32. PNG "alt=" Wkiol1csnoyrp-zjaaazzedtolw228.png "src=" http://s1.51cto.com/wyfs02/M00/7F/C6/ Wkiol1csnoyrp-zjaaazzedtolw228.png "/>

* Can see that the information of the two files is identical

In fact, hard links do not increase the number of inode because they are actually using the inode of the actual file, just adding the associated data in a directory

* in hard link production it is still possible to change the system block, that is, when you add this data just to fill the directory block, there may be a new block to record the association of files resulting in disk space changes

Limitations of hard Links:

1. Cannot Cross file system

2. You cannot connect to the directory

B. Symbolic links

Create command: Ln-s

The Symbolic link is the shortcut, we create a separate file , and the file's data is read to the file name of the file to which he is connected.

650) this.width=650; "Title=" Foundation 33. PNG "style=" float:left; "alt=" Wkiom1csnbwz4bwvaadb5z7m_cm087.png "src=" http://s5.51cto.com/wyfs02/M01/7F/C8/ Wkiom1csnbwz4bwvaadb5z7m_cm087.png "/>

The important thing about the connection file is that it will write the file name of the target .

Let's raise a chestnut.

650) this.width=650; "Title=" Foundation 34. PNG "alt=" Wkiol1csno2dwh_3aabdiw0ybno856.png "src=" http://s5.51cto.com/wyfs02/M01/7F/C6/wKioL1csNo2DwH_ 3aabdiw0ybno856.png "/>

you can see that the linked file has an arrow pointing to the source file. And their size is not the same.

The file created by the symbol link is a standalone new file that will occupy our inode and block

If the target file is deleted then: You will not be able to access the contents of the file

Although the symbolic link is not so secure but his limit is very small, so the use of a wide range


This article is from the "Zimomo" blog, make sure to keep this source http://zimomo.blog.51cto.com/10799874/1770737

Linux Basics Three--how much does a linked file know?

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.