Author Topic: Inode / Using Inode To Delete Files or Directories  (Read 1014 times)

Offline scotbuff

  • Sys Admin
  • UNIX User
  • *****
  • Posts: 174
  • Karma: +2/-0
    • View Profile
    • Scott.Buffington.me
Inode / Using Inode To Delete Files or Directories
« on: November 15, 2005, 08:09:52 pm »
This works on both AIX and Linux

$ touch \"monkey*

1.) Now try to remove this file with rm command:
$ rm "monkey*
2.) Now use inode number to remove file:
$ ls -il
Code:
total 0
   56 -rw-r--r--   1 sbuffing adm               0 Nov 10 10:53 "monkey*
Note that first column displays file inode number (56).
3.) Remove file with find command:
$ find . -inum 56 -exec rm -i {} \;

Note you can also use add escape character \ before special character in filename to remove it directly so the command would be:
$ rm \"monkey\*