1、创建一个软连接

[root@auc-linux home]# ln -s /usr/hb/ /home/hb_link

 

 

2、删除软连接出现错误

 

[root@auc-linux home]# rm /home/hb_link/

 

rm: 无法删除"/home/hb_link/": 是一个目录

 

 

3、删除软连接的正确方式

 

[root@auc-linux home]# rm /home/hb_link/

 

rm: 无法删除"/home/hb_link/": 是一个目录

 

[root@auc-linux home]# rm /home/hb_link

 

rm:是否删除符号链接 "/home/hb_link"?y

 

 

4、只是删除了软连接文件(正确方式)

 

[root@auc-linux home]# rm -rf /home/hb_link

 

[root@auc-linux home]# ll /usr/hb/

 

总用量 4

 

-rw-r--r-- 1 root root 12 6月   4 18:09 hb.txt

 

5、错误操作,通过软连接删除了实际存在的数据。

[root@auc-linux home]# ln -s /usr/hb /home/hb_link

[root@auc-linux home]# ls

1234.cap  freeswitch.bin  logs        monitor      packages.tar.gz  www

Adtec     hb_link         lost+found  monitor_log  recordings

[root@auc-linux home]# rm -rf /home/hb_link/

[root@auc-linux home]# ls

1234.cap  freeswitch.bin  logs        monitor      packages.tar.gz  www

Adtec     hb_link         lost+found  monitor_log  recordings

[root@auc-linux home]# cd hb_link/

[root@auc-linux hb_link]# ls

[root@auc-linux hb_link]# cd /usr/hb/

[root@auc-linux hb]# ls
-----------------------------------
linux删除软链接的正确方式
https://blog.51cto.com/kusorz/1876315

 

备注:想要删除链接文件要用以下命令 rm   /home/hb_link 只是少了一个“ / ” 删除的 就是链接文件, 也就是在文件名的最后不要加上/

 

 

 

相关文章:

  • 2022-02-26
  • 2022-01-14
  • 2021-10-12
  • 2022-12-23
  • 2021-07-09
  • 2021-06-28
  • 2022-02-13
猜你喜欢
  • 2021-09-03
  • 2022-01-21
  • 2021-10-24
  • 2022-12-23
  • 2021-06-25
  • 2022-01-02
  • 2021-05-17
相关资源
相似解决方案