i created a soft link from my home folder to /etc/ by using
"ln -s /etc/ foo"
then i changed directory to foo
"cd foo"
now i executed the following two commands
"pwd" and "/bin/pwd"
Both gave me different outputs.
The output of “pwd” was /home/myhome/foo and of “/bin/pwd” was /etc.
I am not able to understand the difference in the outputs although both commands are the same.
Possibly a bit oversimplified, but the
bashbuiltinpwdtrackscdcommands, so when youcdthrough a symbolic link, it remembers that. On the other hand,/bin/pwdwalks the directory tree back to the root, and, as such, has no idea what symbolic links you might have walked through to get where you are.