It’s the simple things in life… Sometimes you simply want to know the canonical path for your current working directory.
Here is a symbolic link to a directory.
lrwxrwxrwx 1 14 Mar 29 10:54 /home/crashingdaily/symlink -> im/a/real/path
I change to the directory using the symbolic link.
The ‘pwd’ bash builtin does not resolve symbolic links so reports that I’m in the ‘symlink’ directory.
‘/bin/pwd’ reports the canonical path.
I can leverage this to quickly change my path from symlinked to real.
$ cd `/bin/pwd`
readlink is advantageous if you need to resolve paths outside your current working directory.
Update: Sometimes the simpler things are right under your nose.
were sitting there all along. No need for /bin/pwd (for bash at least). RTFM, indeed.