Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of deleting or renaming garbled files under CentOS

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the method of deleting or renaming garbled files under CentOS. The content of the explanation in the article is simple and clear, and it is easy to learn and understand. Please follow Xiaobian's train of thought to study and learn "the method of deleting or renaming garbled files under CentOS".

When the file name is garbled, the file name cannot be entered through the keyboard, so it is impossible to use commands such as rm,mv to manage the file directly under the terminal.

When the file name is garbled, the file name cannot be entered through the keyboard, so it is impossible to use commands such as rm,mv to manage the file directly under the terminal.

But each file has an I-node number, which can be managed by the I-node number. First, get the I node number of the file. This can be obtained from the-I option of the ls command.

I. Delete

Step 1: get the id number of the file

Ls-li

Step 2: perform deletion

Find. -inum 32983551-exec rm {}\

II. Renaming

Find. -inum 32983542-exec mv {} test.php\

When the file name is garbled, the file name cannot be entered through the keyboard, so it is impossible to use commands such as rm,mv to manage the file directly under the terminal.

But each file has an I-node number, which can be managed by the I-node number. First, get the I node number of the file. This can be obtained from the-I option of the ls command.

-bash-3.00$ ls-I

41697812 a 32983551 di 32983554 ethnet.c 32983543 hard_link

32983542 de.c 32983544 ethnet 32983541 ethnet.h 32983543 kstat

The number before each file name is the I node number of the file. With the I node number of the file, we can use the-inum option of the find command to cooperate

Commonly used file management commands for file management. For example, if you want to delete the di file, the command is as follows:

-bash-3.00$ find. -inum 32983551-exec rm {}\

-bash-3.00$ ls

A de.c ethnet ethnet.c ethnet.h hard_link kstat

Look, the di file has been deleted. Because this example runs on a unix-center machine, there is no file named garbled as an example.

But the reason is the same, does not affect our understanding.

To rename a file, the command is also simple, as follows:

-bash-3.00$ ls-I

32983542 de.c 32983554 ethnet.c 32983543 hard_link 32983545 kstat.c

32983544 ethnet 32983541 ethnet.h 32983543 kstat 32983681 sys_link

-bash-3.00$ find. -inum 32983542-exec mv {} di.c\

-bash-3.00$ ls-I

32983542 di.c 32983554 ethnet.c 32983543 hard_link 32983545 kstat.c

32983544 ethnet 32983541 ethnet.h 32983543 kstat 32983681 sys_link

Look, the de.c file has been renamed di.c. In particular, the "{}" in the find command represents the file found by the find command in the

When the-exec option executes the mv command, it replaces "{}" with the file name found by I node number

Thank you for your reading, these are the contents of "deleting or renaming garbled files under CentOS". After the study of this article, I believe you have a deeper understanding of the method of deleting or renaming garbled files under CentOS, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report