小知识点:Linux删除‘-’开头的文件
先看两个特殊文件(以-开头)
[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
上面两个文件用普通方法无法删除
[]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
两个文件已被删除,点个赞
来自:Linux命令手册
往期推荐
关注「开源Linux」加星标,提升IT技能

评论

