Home  >  Article  >  Operation and Maintenance  >  The difference between hard links and soft links in linux

The difference between hard links and soft links in linux

王林
王林Original
2019-12-25 16:44:396522browse

The difference between hard links and soft links in linux

1. By default, the ln command without parameters creates a hard link, and the ln command with the -s parameter creates a soft link.

2. The inode node number of the hard link file is the same as the source file, but the inode node number of the soft link file is different from the source file.

3. The ln command cannot create hard links to directories, but it can create soft links. Soft links to directories are often used.

4. Deleting soft link files has no impact on the source files and hard link files.

5. Deleting the hard link file of the file has no impact on the source file and the linked file.

Recommended related learning video tutorials: linux video tutorial

6. Deleting the source file of the linked file has no effect on the hard link, but will cause its soft link to become invalid (red background White letters flashing) 7), delete the source file and its hard link file at the same time, and the entire file will be truly deleted.

7. The snapshot function in many hardware devices uses a principle similar to that of hard links.

8. Soft links can cross file systems, but hard links cannot cross file systems.

Attachment: Two ways to create links are as follows:

 ln -s 源文件  链接文件      # 创建软链接
 ln  源文件  硬链接文件     # 创建硬链接

Recommended related articles and tutorials: linux tutorial

The above is the detailed content of The difference between hard links and soft links in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn