Create a hard link my-hard-link to the file myfile.txt, which means "create a file that should point to the same inode that myfile.txt points to":
$ ln myfile.txt my-hard-link
Create a soft link my-soft-link to the file myfile.txt, which means "create a file that should point to the file myfile.txt":
$ ln -s myfile.txt my-soft-link
Look what will now happen if myfile.txt is deleted (or moved): my-hard-link still points to the same contents, and is thus unaffected, whereas my-soft-link now points to nothing. Other answers discuss the pros/cons of each.
有一天,我下载了一个软件到文件夹Downloads进行安装。在我做了sudo make install之后,一些可执行文件被cped到本地bin文件夹。在这里,cp创建硬链接。我对这个软件很满意,但很快意识到Downloads从长远来看不是一个好地方。所以我mv将软件文件夹source目录。嗯,我仍然可以像以前一样运行软件,而不用担心任何目标链接的事情,就像在Windows中一样。这意味着硬链接直接找到inode和周围的其他文件。
有一天,我下载了一个软件到文件夹下载安装。在我做sudo make install之后,一些可执行文件被cp到本地bin文件夹。在这里,cp创建硬链接。我对这个软件很满意,但很快意识到从长远来看下载不是一个好地方。所以我把软件文件夹移动到源代码目录。嗯,我仍然可以像以前一样运行软件,而不用担心任何目标链接的事情,比如在Windows中。这意味着硬链接可以直接找到inode和周围的其他文件。
* abc.com and def.com -> points to the IP 1.2.3.4* abc.com and def.com -> files in linux* IP -> inode in linux* By deleting the domain abc.com users still access your website through def.com or vice versa* Mutation through abc.com will affect def.com and vice verca
Sym Link:将一个域重定向到另一个域
* accessing abc.com will redirect to def.com as you've accessed def.com directly* removing the def.com domain will break the link abc.com