Sometimes it’s annoying to access a directory with the folder name. Say I have a directory named a b c d
. Apart from using Tab, is there any way to access the folder without typing the name of the directory?
I know that Linux has a unique identifier every particular file. Can I use this to access the folder? I don’t know whether this can be actually done or how to do it.
I that think when Linux implements a filesystem, it compares two directory names’ uniqueness. So each directory must be unique in a space. But I think that it’s like a primary key in a database system. Is the primary key the name of the directory or is there some other unique identifier (perhaps some numbers stored “under the hood”)?
Try to think of this like a process. If you execute the command ps
on a terminal, it outputs a process list with the name and number of each process. You have to call that process with the process number. Similarly, is there a number for a directory so that you could call the directory with its number instead of calling it with its name?
On further investigation, I have found that each directory has a unique inode
. However, I have not so far found any built-in command to access a directory by its inode
.
Best Answer
Solution made by OP
No built-in command found here . But finally I am able to write a C program to use cd(lets call my program icd == (inode cd) ) to enter in a folder using inode value. Here I am posting the raw code.
But there is a fundamental problem I have faced here. While coding execution a C code from a bash needed to create child process under the bash process(parent process). From the child process the directory space is new, and I can not access parent process's directory space from there. So nothing could be done except invoked a new bash window from here. In future I will try to implement a new tab feature if people are interested in this. But I believe I have faced a lot of criticism for doing this. So people might not be interested. I have just done for my amusement.
RAW code is shared here,
I am using gnome terminal here. Obviously For other distro the code will be changed.