命令表示

  1. ln

命令用法示例

  1. ln -s [源文件] [链接文件] (硬链接无需-s)
  2. 如:ln -s test.txt shotcut

命令解释

软链接文件:所有人可访问,类似于windows的快捷方式,仅指向源文件

硬链接文件:类似于copy,完全复制源文件,且同步更新

如下所示新建一个软链接指向test.txt文件,可以看到test-s软链接指向test.txt文件

ln -s test.txt test-s

image.png
为test.txt创建一个硬链接

ln test.txt test-l

image.png

修改test-l文件

vim test-l

image.png

输出test.txt文件内容

cat test.txt

image.png