如何刪除檔案名稱包含奇怪字元的檔案?

如何刪除檔案名稱包含奇怪字元的檔案?
[root@host dir1]# ls -lrt
total 412
-rw-r--r-- 1 root root  13747 Jun  3 16:01 -lang?[5~?[5~?[5~?[5~?:q!

我們嘗試了不同的方法,但都不起作用。

[root@host dir1]#  ls -lrt | tail -1 | awk '{print $9}' | xargs -I file rm file
rm: invalid option -- 'l'
Try `rm ./'-langq!'' to remove the file `-lang\033[5~\033[5~\033[5~\033[5~\033:q!'.
Try `rm --help' for more information.

[root@host dir1]# rm ./'-langq!''
> ^C

答案1

我創建了一個包含奇怪字符的文件,然後將其刪除:

rm *lang*

通配符讓每個人的生活更輕鬆。由於字元要求,我輸入了這兩句話。

相關內容