Linux soft and hard connection knowledge points

Source: Internet
Author: User

Hard Link Knowledge points summary:

1. Multiple files with the same inode number are hard-linked files.

2, delete the hard link file or delete any of the source files, the file entity has not been deleted.

3, only delete the source file and all the corresponding hard link files, the file entity will be deleted.

4, when all the hard link files and the source files are deleted, when the new data will occupy the space of the file, or the disk fsck check, the deleted data will be collected by the system. (The principle of file deletion)

5, the hard link file is another entrance to the file (equivalent to a time-out front door, the back door).

6. You can prevent important files from being mistakenly deleted by setting hard-link files to files.

7. You can create a hard link by executing the command "ln source file Hard link file".

8. Hard link files can be deleted with rm command.

9, for the static file (no process is calling the file), when the corresponding number of hard links is 0 (i_link), the file Ijust is deleted. I_link View Method (the third column of the ls-l result is)

Variable for file deletion control:

Number of hard links to the I_link file

I_coung reference count (there is a program using I_count plus 1)

Conditions for file deletion

I_link=0 and I_count=0

Soft Connection Knowledge Summary:

1. Soft links similar to Windows shortcuts (you can view them by Readlink)

2, soft links like a text file, which is stored in the source file path, pointing to the source file entity.

3. Delete the source file, the soft link file still exists, but cannot access the content of the source file.

4, the failure of the time is generally a white-light red background flashing hint.

5, execute the command "ln-s source file Soft link file", you can complete the creation of soft links (the target cannot exist).

6, soft links and source files are different types of files, is also a non-pass file. The inode number is not the same.

7. Delete the soft link file can be used with rm command.

A summary of the links to the files:

1. Deleting soft link files has no effect on source files and hard link files.

2. Delete hard-link files has no effect on source files and soft link files

3, delete the source file, the hard-link file has no effect, but will cause the soft link file invalidation, white and white red background flashing.

4, while deleting the source files, hard-link files, the entire file will be really deleted

5, source files and hard-link files have the same index node number, can be considered to be the same file or multiple portals of a file

6, the source file and the soft Link file index node number is different, is different file, soft link equivalent to the source file shortcut, contains the source file location point

For a summary of directory links

1. For a directory, you cannot create a hard link, but you can create a soft link

2, the soft link for the catalog is the production scene operation of the common thousands of

3, the directory of hard links cannot cross the file system (from the hard link principle can be understood)

4. There is a hard link under each directory "." , and the hard link corresponding to the parent directory "..."

5, create a subdirectory in the parent directory, the parent directory of the number of connections increased by 1 (subdirectories have: To point to the parent directory)

However, creating a file in the parent directory does not increase the number of links in the parent directory.

This article from "My Blog" blog, declined reprint!

Linux soft and hard connection knowledge points

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.