How to delete files with a file name that is garbled or with special characters under Linux

Source: Internet
Author: User
Today encountered a problem, a filename is "-mxv9.log", directly with RM deleted when the error

[Localhost]rm-mxv9.log

Rm:illegal Option--M

Rm:illegal Option--X

USAGE:RM [-rfir] File ...


began to think of the quoted number of deletion, found that the quotation is the same as reported illegal option error

Find some information, found that this file can be deleted


Ls-i the inode of the file, and then use the Find command to delete

[LOCALHOST]LS-ILRT


100985-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 {} \;


This method is suitable for file deletion with garbled file name or special characters.


For example, the file name is "*.txt" if you execute RM *.txt directly, all files in the folder ending in. txt will be deleted.


How to delete files with a file name that is garbled or with special characters under Linux

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.