Click here to edit subtitle


Post Reply
Forum Home > Unix Learnings > Change Directory using its Inode Number

Sourav Gulati
Site Owner
Posts: 83

Lets Suppose you have downloaded a Directory/Folder which have an odd name that cannot be used with "cd" command .

For Example " -ROOT ".

If you try to run command cd -ROOT, you will get error as follows:

cd: -R: invalid option

So you can "cd" to this directory using its inode number which you can get running "ls -i" in the directory where it is placed. For example its inode number is :

5511344 -ROOT-

Now since "cd" is a shell utility not a command so you cannot do

find . -inum 5511344 -exec cd {} \;          ------------ Incorrect

In order to "cd" using Inode you can run following command:

cd $(find . -inum 5511344)


August 9, 2012 at 8:26 AM Flag Quote & Reply

You must login to post.