背景:由于在linux上使用rz上传文件的时候,没有选对文件格式导致命令行生成了好多乱码的文件,非常影响使用体验。

分析:在linux中,有这么一句话-“一切皆文件”,所以即使是乱码文件,其本身在文件系统中也是文件,那既然是文件,就必定有inode,有了这个思路下来就好处理了。
操作:
step1:查找乱码文件的inode号
[root@k8s-m1 ~]
total 12
394258 -rw-r--r-- 1 root root 46 Sep 23 18:36 㽽??3%uZ,+
394260 -rw-r--r-- 1 root root 46 Sep 23 18:36 㽽??3%uZ,+?6??~??
394226 -rw-r--r-- 1 root root 0 Sep 23 18:36 ???7ߘ??w??zy??
394251 -rw-r--r-- 1 root root 0 Sep 23 18:36 ??8ͳ??O{
z?{
??????:
394257 -rw-r--r-- 1 root root 0 Sep 23 18:36 ??B
394252 -rw-r--r-- 1 root root 0 Sep 23 18:36 ??????czU}f??
394250 -rw-r--r-- 1 root root 0 Sep 23 18:36 ?g
394254 -rw-r--r-- 1 root root 0 Sep 23 18:36 ??ߴ???g????
394253 -rw-r--r-- 1 root root 0 Sep 23 18:36 ??ߴgX??M?M{
??
394256 -rw-r--r-- 1 root root 0 Sep 23 18:36 ??ĻD??W?
1454457 drwxr-xr-x 11 root root 4096 Oct 11 11:52 pkg
394259 -rw-r--r-- 1 root root 0 Sep 23 18:36 ??,????Se?h?KG}???
394255 -rw-r--r-- 1 root root 0 Sep 23 18:36 ??ߴ?????????V?
394261 -rw-r--r-- 1 root root 0 Sep 23 18:36 Z???y??z?

step2:根据inode节点号来确认文件
[root@k8s-m1 ~]
394258 394260 394226 394251 394257 394252 394250 394254 394253 394256 394259 394255 394261

step3:删除文件
for i in 394258 394260 394226 394251 394257 394252 394250 394254 394253 394256 394259 394255 394261; do find ./ -inum $i -delete; done
