13 Hard and Soft Links

13.1 The difference between hard links and soft links

        Hard link: A---B, assuming that B is a hard link of A, as long as there is one, no matter which one is deleted, the file can be accessed.

        Soft link: Similar to a shortcut, if you delete the source file, the shortcut will not be accessible.

13.2 Create a link using the ln command

13.2.1 Create hard links

        Link f2 to f1 (f1 is the file created at the beginning), and f2 will be generated at this time.

ln f1 f2

13.2.2 Creating soft links (symbolic links)

        Link f3 to f1 (f1 is the file created at the beginning), and f3 will be generated at this time.

ln -s f1 f3

        After creating a soft link, the resulting f3 is blue. 

13.2.3 Experiments for 13.1

        Change f1, both f2 and f3 will change:

        After deleting f1: f2 (hard link) is still there, but f3 is marked red, and f3 (soft link/symbolic link) is invalid.

 

 

Guess you like

Origin blog.csdn.net/no996yes885/article/details/131952252