加入收藏 | 设为首页 | 会员中心 | 我要投稿 520站长网 (https://www.520shu.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 服务器 > 搭建环境 > Linux > 正文

linux删除软链接的正确方式

发布时间:2022-11-03 14:01:20 所属栏目:Linux 来源:网络
导读: linux删除软链接的正确方式
1、创建一个软连接
[root@auc-linux home]# ln -s /usr/hb/ /home/hb_link
2、删除软连接出现错误
[root@auc-linux home]# rm /home/hb_link/
rm: 无法删除"/ho

linux删除软链接的正确方式

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

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

(编辑:520站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!