小知識(shí)點(diǎn):Linux刪除‘-’開(kāi)頭的文件
先看兩個(gè)特殊文件(以-開(kāi)頭)
[root@node_119 test]# lltotal 0-rw-r--r-- 1 root root 0 Aug 3 08:59 -rf *-rw-r--r-- 1 root root 0 Aug 3 09:00 -test
上面兩個(gè)文件用普通方法無(wú)法刪除
[]rm: invalid option -- ' 'Try 'rm ./'-rf *'' to remove the file ‘-rf *’.Try 'rm --help' for more information.[]rm: invalid option -- ' 'Try 'rm ./'-rf *'' to remove the file ‘-rf *’.Try 'rm --help' for more information.
刪除方法,在文件名前加--
[root@node_119 test]# rm -rf -- '-rf *'[root@node_119 test]# rm -rf -- -test[root@node_119 test]# lltotal 0
兩個(gè)文件已被刪除,點(diǎn)個(gè)贊
來(lái)自:Linux命令手冊(cè)
往期推薦
關(guān)注「開(kāi)源Linux」加星標(biāo),提升IT技能

評(píng)論
圖片
表情

