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
-----------------------------------
linux刪除軟鏈接的正確方式
https://blog.51cto.com/kusorz/1876315

 

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

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM