首页 > 技术文章 > Linux-软连接与硬链接

LFTW 2020-10-17 20:12 原文

软连接与硬链接

软连接类似于Windows下的快捷方式

硬链接相当于备份,建立多个路径,防止误删

  • touch:创建文件

  • echo:写入内容到文件中,其中>写入覆盖文件所有内容,>>在文件尾部追加

[root@dragon home]# ls
admin  test1  www
[root@dragon home]# ln test1 test2
[root@dragon home]# ls
admin  test1  test2  www
[root@dragon home]# echo "IMA" >> test1
[root@dragon home]# cat test1
IMA
[root@dragon home]# cat test2
IMA
[root@dragon home]# ln -s test3
[root@dragon home]# ls
admin  test1  test2  test3  www
[root@dragon home]# ln -s test1 test3
[root@dragon home]# ls
admin  test1  test2  test3  www
[root@dragon home]# ll
total 16
drwx------ 3 admin admin 4096 Dec 31  2019 admin
-rw-r--r-- 2 root  root     4 Oct 13 22:00 test1
-rw-r--r-- 2 root  root     4 Oct 13 22:00 test2
lrwxrwxrwx 1 root  root     5 Oct 13 22:01 test3 -> test1
drwx------ 2 www   www   4096 Oct 13 19:43 www
[root@dragon home]# cat test3
IMA

推荐阅读