Linux 删除 文件名乱码的文件
admin
2023-05-30 18:27
短信预约 -IT技能 免费直播动态提醒
1 现象
wget 下载的时候少了个参数,导致目录下生成了几个文件名乱码的文件,直接rm 还删除不了,如下:
https://www.cndba.cn/dave/article/116460
[dave@www.cndba.cn software]# ll
total 1334372
-rwxr-xr-x 1 root root 757260288 Feb 5 16:55 dm8_20211111_x86_rh6_64_ent_8.1.2.18_pack16.iso
-rwxr-xr-x 1 root root 492317201 Feb 5 16:55 dmhs_V4.1.1_dm8_rev99696_rh6_64_veri_20210527.bin
-rw-r--r-- 1 root root 0 Feb 26 21:21 ?G??De??ۯ???C????$?P??bo?gq
drwxr-xr-x 4 omm dbgroup 4096 Feb 18 23:12 openGauss
-rw-r--r-- 1 root root 18539414 Feb 26 21:20 Oracle_VM_VirtualBox_Extension_Pack-7.0.6a-155176.vbox-extpack
-rw-r--r-- 1 root root 98268344 Feb 26 18:39 VirtualBox-7.0-7.0.6.rpm
-rw-r--r-- 1 root root 0 Feb 26 21:21 ??Ο???d?
[dave@www.cndba.cn software]# rm -rf "?G??De??ۯ???C????$?P??bo?gq"
[dave@www.cndba.cn software]# rm -rf "??Ο???d?"
[dave@www.cndba.cn software]# ll
total 1334372
-rwxr-xr-x 1 root root 757260288 Feb 5 16:55 dm8_20211111_x86_rh6_64_ent_8.1.2.18_pack16.iso
-rwxr-xr-x 1 root root 492317201 Feb 5 16:55 dmhs_V4.1.1_dm8_rev99696_rh6_64_veri_20210527.bin
-rw-r--r-- 1 root root 0 Feb 26 21:21 ?G??De??ۯ???C????$?P??bo?gq
drwxr-xr-x 4 omm dbgroup 4096 Feb 18 23:12 openGauss
-rw-r--r-- 1 root root 18539414 Feb 26 21:20 Oracle_VM_VirtualBox_Extension_Pack-7.0.6a-155176.vbox-extpack
-rw-r--r-- 1 root root 98268344 Feb 26 18:39 VirtualBox-7.0-7.0.6.rpm
-rw-r--r-- 1 root root 0 Feb 26 21:21 ??Ο???d?
[dave@www.cndba.cn software]#
2 解决方法
直接使用find 命令加inode 来删除。
获取文件inode:
https://www.cndba.cn/dave/article/116460
https://www.cndba.cn/dave/article/116460
[dave@www.cndba.cn software]# ls -il
total 1334372
2959471617 -rwxr-xr-x 1 root root 757260288 Feb 5 16:55 dm8_20211111_x86_rh6_64_ent_8.1.2.18_pack16.iso
2967554705 -rwxr-xr-x 1 root root 492317201 Feb 5 16:55 dmhs_V4.1.1_dm8_rev99696_rh6_64_veri_20210527.bin
2959471619 -rw-r--r-- 1 root root 0 Feb 26 21:21 ?G??De??ۯ???C????$?P??bo?gq
6980221487 drwxr-xr-x 4 omm dbgroup 4096 Feb 18 23:12 openGauss
2959471620 -rw-r--r-- 1 root root 18539414 Feb 26 21:20 Oracle_VM_VirtualBox_Extension_Pack-7.0.6a-155176.vbox-extpack
2959471618 -rw-r--r-- 1 root root 98268344 Feb 26 18:39 VirtualBox-7.0-7.0.6.rpm
2959471616 -rw-r--r-- 1 root root 0 Feb 26 21:21 ??Ο???d?
[dave@www.cndba.cn software]# find ./ -inum 2959471619
./?G??De??ۯ???C????$?P??bo?gq
[dave@www.cndba.cn software]# find -inum 2959471619
./?G??De??ۯ???C????$?P??bo?gq
删除文件:
https://www.cndba.cn/dave/article/116460
https://www.cndba.cn/dave/article/116460
[dave@www.cndba.cn software]# find -inum 2959471619 -delete
[dave@www.cndba.cn software]# ll
total 1334372
-rwxr-xr-x 1 root root 757260288 Feb 5 16:55 dm8_20211111_x86_rh6_64_ent_8.1.2.18_pack16.iso
-rwxr-xr-x 1 root root 492317201 Feb 5 16:55 dmhs_V4.1.1_dm8_rev99696_rh6_64_veri_20210527.bin
drwxr-xr-x 4 omm dbgroup 4096 Feb 18 23:12 openGauss
-rw-r--r-- 1 root root 18539414 Feb 26 21:20 Oracle_VM_VirtualBox_Extension_Pack-7.0.6a-155176.vbox-extpack
-rw-r--r-- 1 root root 98268344 Feb 26 18:39 VirtualBox-7.0-7.0.6.rpm
-rw-r--r-- 1 root root 0 Feb 26 21:21 ??Ο???d?
[dave@www.cndba.cn software]# find ./ -inum 2959471616 |xargs -i rm -rf {}
[dave@www.cndba.cn software]# ll
total 1334372
-rwxr-xr-x 1 root root 757260288 Feb 5 16:55 dm8_20211111_x86_rh6_64_ent_8.1.2.18_pack16.iso
-rwxr-xr-x 1 root root 492317201 Feb 5 16:55 dmhs_V4.1.1_dm8_rev99696_rh6_64_veri_20210527.bin
drwxr-xr-x 4 omm dbgroup 4096 Feb 18 23:12 openGauss
-rw-r--r-- 1 root root 18539414 Feb 26 21:20 Oracle_VM_VirtualBox_Extension_Pack-7.0.6a-155176.vbox-extpack
-rw-r--r-- 1 root root 98268344 Feb 26 18:39 VirtualBox-7.0-7.0.6.rpm
[dave@www.cndba.cn software]#
免责声明:
① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。
② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341