The difference between hard links and soft links in linux

王林
Release: 2019-12-25 16:44:39
original
6292 people have browsed it

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 源文件  链接文件      # 创建软链接
Copy after login
 ln  源文件  硬链接文件     # 创建硬链接
Copy after login

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!

source:php.cn
Statement of this Website
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 [email protected]
Popular Tutorials
More>
Latest downloads
More>
web effects
Website source code
Website materials
Front end template
About us Disclaimer Sitemap
PHP Chinese website:Public welfare online PHP training,Help PHP learners grow quickly!