63

Linux删除乱码文件的方法

 5 years ago
source link: https://www.linuxprobe.com/linux-code-methon.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

当文件名为乱码的时候,无法通过键盘输入文件名,所以在终端下就不能直接利用rm,

mv等命令管理文件了。

但是我们知道每个文件都有一个 i 节点号,我们可以考虑通过 i 节点号来管理文件。

首先,我们要取得文件的 i 节点号。这个可以通过ls命令的-i 选项获得得,也可以通过ll -i 来获得。

第二步,使用find命令将文件名传递给rm命令。

e.g:删除节点为12345的乱码文件夹可以使用如下命令:

find ./ -inum 12345 -print -exec rm {} -rf /;

注意/;前面的空格不能少,少了就会报错。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK