Get the App
SLTechnology News&Howtos  ›  Network Security  › 

The difference between ln soft links and hard links

Shulou Source: shulou.com Published: 2022-06-01 04:17:00 10月06日 Update

How to create a software link: # ln-s source file target file

How to create hard links: # ln source file target file

Characteristics of hard links

1. Hard-linked files have the same inode node number

two。 Delete the hard link file or delete one of the source files, the file entity has not been deleted

3. The file entity will be deleted only if the source file and all corresponding hard-linked files are deleted.

4. When all hard-linked files and source files are deleted, the new file created takes up space in the file.

5. Modify any hard link file, and all associated hard link files and source files will be modified at the same time.

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

7. When the number of hard-linked file connections to a file is 0, the file is deleted (the third column of ls-l is the number of hard-linked links)

8. Directories cannot create hard links

Characteristics of soft links:

1. Soft links, also known as symbolic links, are equivalent to shortcuts in windows, and the file type is l

two。 A soft link is similar to a text file in which the path of the source file is stored and points to the source file entity.

3. Delete the source file, the soft link file still exists, but the contents of the source file path cannot be accessed

4. Soft links are different types of files, different files, and different inode numbers

Tags: File link source file entity way different same characteristic target type path important number content only can pass at the same time point to text directory Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Docker Shulou Technology Xiaomi macOS