cd /proc/$$/root/bin
cd /bin
After running ls
command on both the directory, I found that content of both directories are same (which is nothing but list of commands).
Is there any specific reason for this having same command-list in both directory?
Best Answer
/proc
is a "virtual" filesystem exposing some kernel and process related details.$$
is a shell variable giving the PID of the shell running it./proc/$$/root
is a symbolic link to the root directory as seen by the current shell. This could change in case you are chrooting.In short, the two look identical because they are the same directory. If you execute
ls -ld /proc/$$/root
you will see that it is a symbolic link to/
, and therefore/proc/$$/root/bin
and/bin
are the same directory.