What is the difference between hard links and soft links in linux
1. By default, without parameters, the ln command creates hard links, while the ln command with the-s parameter creates soft links.
2. The inode node number of the hard link file is the same as that of the source file, while the inode node number of the soft link file is different from that of the source file.
3. The ln command cannot create hard links to directories, but soft links can be created, and soft links to directories are often used.
4. Deleting the soft link file has no effect on the source file and the hard link file.
5. Deleting the hard-linked file of the file has no effect on the source file and the linked file.
Related learning video tutorials recommended: linux video tutorials
6. Deleting the source file of the linked file has no effect on the hard link, which will lead to the invalidation of the soft link (flashing white words on the red background) 7). At the same time, delete the source file and its hard link file, the whole file will be really deleted.
7. The snapshot function in many hardware devices uses the principle of hard link.
8. Soft links can span file systems, while hard links cannot cross file systems.
Attachment: there are two ways to create links as follows:
Ln-s source file link file # create soft link ln source file hard link file # create hard link
These are the details of the difference between hard links and soft links in linux. Please pay more attention to other related articles!