1.刪除帶“-”的文件名的方法
使用-- (2個橫杠)
#touch -- -%F-%T
#rm -- -%F-%T
rm: remove regular empty file `-%F-%T'?
使用絕對路徑并TAB特殊文件名
#rm /root/-%F-%T
rm: remove regular empty file `/root/-%F-%T'?
2. 刪除包含其它特殊字符的文件
對于含有其它特殊字符的文件名,如<>!*等,
可用
“”轉義符\或“”雙引號
#touch ">123file"
#rm ">123file"
rm: remove regular empty file `>123file'?
#touch '!rul4'
#rm \!rul4 ? 如果在此處使用TAB鍵系統將會自動幫你調整為正確刪除的語法。
rm: remove regular empty file `!rul4'?
3.刪除系統打不出的亂碼文件名
先使用ls -i 查到文件的inode,然后用find命令刪除
# ls -ilrt?
?100985 -rw-r--r-- ?1 tbcs ? ? ?users ? ? ? ? ? ?0 Apr 18 11:32 -MXV9.log
最前面一列的100985就是文件的inode,在主機上執行如下命令即可刪除文件
find ./ -inum 100985 -exec rm {} \;
轉載于:https://blog.51cto.com/191226139/1981392