Delete Files With Inode Number

An inode stores basic information about file/directory or other file system object.

Now,why we delete file by using inode number? when we can delete files using rm command.
This is because sometimes we accidentally creates filename with control characters or special characters like  ?, * ^, which can not be deleted by normarl rm command.Here we can delete files using inode numbers.

How to find out inode number?

Using following command in the respective directory we can find out the inode number of the files.

ls -il

6848619 drwxr-xr-x   2 root root       4096 Dec 29 11:19 S??*???=????x?’????q???
6684807 -rwsrwsrwt   1 root root          0 Feb  7  2106 ???t$.???[.;%????’2${??

How to delete file using inode number?

Say we want to delete file “???t$.???[.;%????’2${??” having inode number 6684807 .

find . -inum 6684807  -exec rm -i {} \;