通过inode删除特殊字符文件

对于正常使用rm无法删除的文件可以通过查找inode进行删除

ls -i
find  -inum xxx  -delete

or

ls -i
find  -inum xxx  -exec rm -i {} \;
  • 直接删除
[root@centosgpt vm]# ls -i
 2278688 >           13592459 memdump2.c~      13592454 memzero           7506486 test.c~
 2275894 118902.mem   2275882 memdump2.py      13592461 memzero.c         9733651 translate
 ...

[root@centosgpt vm]# find -inum  2278688 -delete
[root@centosgpt vm]# ls
118902.mem  idle.py~     memdump3.c   memory_layout    processwrite.c   test.c~            vsyscall.c
18          memdump      memdump4     memory_layout.c  processwrite.c~  translate   

  • 交互式

[root@centosgpt vm]# ls -i 7506464 > 13592459 memdump2.c~ 13592454 memzero 7506486 test.c~ 2275894 118902.mem 2275882 memdump2.py 13592461 memzero.c 9733651 translate [root@centosgpt vm]# find -inum 7506464 -exec rm -i {} \; rm: remove regular empty file ‘./>’? y [root@centosgpt vm]# ls 118902.mem idle.py~ memdump3.c memory_layout processwrite.c test.c~ vsyscall.c 18 memdump memdump4 memory_layout.c processwrite.c~ translate

Be First to Comment

发表回复