Click here to edit subtitle


Post Reply
Forum Home > Unix Learnings > Access a file using its Inode Number

Sourav Gulati
Site Owner
Posts: 83

Lets suppose you have downloaded a file on your unix system which has some name that cannot be used with unix commands. For example, name of the file is "-ROOT- " . Now if you try to  copy , delete or rename this file

i.e  mv  -ROOT-  ROOT

you will get error saying something like invalid option -R .

You can access this file using its inode number which can you get by running "ls -i " in the directory that contains the file.

Lets suppose inode number of  -ROOT- is 15487

so you can perform above operations as

find . -inum 15487 -exec mv {} ROOT \;

Also, while you can delete this file as follows

find . -inum 15487 -exec rm {} \;



August 9, 2012 at 7:21 AM Flag Quote & Reply

You must login to post.