Linux Delete garbled file name or directory name

Source: Internet
Author: User

Sometimes, the RZ upload file failed or accidentally input command will produce garbled file name. Since the deletion of special characters with RM is basically invalid, the following two easy-to-use methods have been found:

Example:

[Email protected]:~]$ ls
?? ?? B?? G????? e#? Allium chinense? T
? 7?%?? S?^d?? X??? b timestamp falcon-agent-5.1.0.tar.gz

1.RM command

RM./*

Because the RM command will be asked before deleting the file, we can use RM Inquiry mechanism to delete garbled files.

Confirm that you want to delete the garbled file enter Y, and other reply N. The period can be ended with CTRL + C at any time

[Email protected]:~]$ rm./*
Rm:remove regular file './\245\373b\253\272g\224\257\374\346\370e#\245 Allium chinense \277t ko\376\335\322\332k%\325m~p\347jbs\ 364]\245\345b#\250\311[\203m\376\320y\372\375lzn.\3227 '? y
Rm:remove regular file './falcon-agent-5.1.0.tar.gz '? N
Rm:remove regular empty file './m\277m\233\260+\263bo '? Y
Rm:remove regular file './yc_linkd-nmob_2.6_ex_ctl-64.tar.gz '? N

Note: Make sure the RM command is not Alais into RM-RF first

2. Locate the index node to delete (Inode)

Find./-inum 54263996-exec rm {}-RF \;

[[Email protected]:~]$ Ls-li
Total 11420
6176785-rw-rw-r--1 Langxiaowei langxiaowei 0 Oct 13 17:26? 7?%?? S?^d?? X??? b Timestamp
6176784-rw-rw-r--1 Langxiaowei langxiaowei Oct 13 17:26?? B?? G????? e#? Allium chinense? T ko???? K%?m~p? JbS?]?? b#?? [? m?? Y?? Lzn.? 7
6176782-rw-r--r--1 Langxiaowei langxiaowei 3203523 10:02 falcon-agent-5.1.0.tar.gz
6176787-rw-rw-r--1 langxiaowei langxiaowei 0 Oct 14:15 m?m?? +?bo

[Email protected]:~]$ Find/-inum 6176785-exec rm-rf {} \;

This deletes the corresponding file by deleting the Inode

Linux Delete garbled file name or directory name

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.