Delete garbled file names in Centos

Source: Internet
Author: User
In centos, you can use the rm command to delete files. However, if you want to delete a file with garbled file names, you cannot directly use the rm command because the file name cannot be output at all. However, the find command can be used to delete it. In linux, each file has a corresponding constant inode number. you can use ls-li to view the inode number of the file, and find can be searched by inode number, in addition, other commands can be executed in the find command. Follow these steps: use ls-li to obtain the garbled characters to be deleted.

In centos, you can use the rm command to delete files. However, if you want to delete a file with garbled file names, you cannot directly use the rm command because the file name cannot be output at all. However, the find command can be used to delete it. In linux, each file has a corresponding constant inode number. you can use ls-li to view the inode number of the file, and find can be searched by inode number, in addition, other commands can be executed in the find command. Follow these steps:

  1. Use ls-li to obtain the inode number of the file whose garbled file name is to be deleted. for example, the obtained result is 123456.

  2. Delete

Find./-inum 123456-exec rm-rf {}\;

Note:"{}" Must be added with "\;".


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.