Hard and soft connections in Linux

Source: Internet
Author: User

Hard and soft connections in Linux

    • Hard and soft connections in Linux
      • Background
      • Connection
      • Hard Connect
      • Soft connection
      • Example
      • Reference

Background

The files in Linux are mainly divided into 3 pieces,
-Real data
-Index node number (Inode index)
-File name

The order in which the files are read is through the file name. Find the appropriate inode. It then finds the corresponding data through the inode and reads it.

Connection

When we need to use the same file in a different folder. We do not need to put in each required folder must have the same file, we just have a fixed folder, put the file, and then in other folders with the LN command link it can be, do not have to repeatedly occupy disk space.

Hard Connect

A hard connection is to point multiple different file names to the same inode index. This is done by a random file name. Will be interviewed for the same data. For example, as seen in the. File name 1, file name 2, file name 3 will access the same data through the same inode.


Soft connection

Soft joins are similar to shortcuts in Windows. It is not directly connected to the inode of the source file, but rather a new special file that records the path of the file name 3 that is connected.

Example
? /tmpLN-S Test test1#symbolic Link? /tmpLNTest Test2#hard Link? /tmp ls-l test*6508253-rw-r[email protected] 2 Deshengkong wheel 3423 7 20:08 test6534236-rw-r--r--1 Deshengkong wheel 103 7 10:22 test.php6544973Lrwxr-xr-x1Deshengkong Wheel4  7  -  One: -Test1-Test# Symbolic Link the type of the file is L (link)6508253-rw-r[email protected] 2 Deshengkong wheel 3423 7 20:08 test2 # Hard link The file type of this file is normal file? /tmp RM Test#delete Source File? /tmp cat Test1#symbolic Link file cannot find the source file. So the error.

cat: test1: No such file or directory? /tmp cat test2 #hard link file 正常

Reference

Http://www.cnblogs.com/itech/archive/2009/04/10/1433052.html
Http://www.cnblogs.com/joeblackzqq/archive/2011/03/20/1989625.html

Hard and soft connections in Linux

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.