Today encountered a problem, a filename is "-mxv9.log", directly with RM deleted when the error, as follows:
[Localhost]rm-mxv9.logrm:illegal Option--mrm:illegal option--xrm:illegal option--vrm:illegal option--9rm:ill Egal option--. Rm:illegal option--lrm:illegal option--orm:illegal option--gusage:rm [-rfir] File ...
This type of file can usually be removed in quotation marks , but it is also quoted as illegal option error.
After finding some information, we find that this kind of file can be deleted: first ls-i The inode of the file and then delete it with the Find command .
[localhost]ls-ilrt100985-rw-r--r-- 1 TBCs users 0 Apr 11:32-mxv9.log
100985 of the first column is the inode of the file, and the file can be deleted by executing the following command on the host
[Localhost]find./-inum 100985-exec rm {} \;
So you can try this method when you encounter files that have file names that are garbled or that have special characters to delete.
This article was reproduced from:http://www.linuxprobe.com/linux-delete-code-special-character-files.html
more Linux Dry Goods visit:http://www.linuxprobe.com/
Delete garbled or special character files under Linux