Delete garbled or special character files under Linux

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.