When I cd
a link, my current path is prefixed with the link's path, rather than the path of the directory the link links to.
E.g.
~/dirlinks/maths$ ls -l logic
lrwxrwxrwx 1 tim tim 71 Jul 27 10:24 logic -> /windows-d/academic discipline/study objects/areas/formal systems/logic
~/dirlinks/maths$ cd logic
~/dirlinks/maths/logic$ pwd
/home/tim/dirlinks/maths/logic
~/dirlinks/maths/logic$ cd ..
~/dirlinks/maths$
I would like to have my current path changed to the path of the linked dir, so that I can work with the parent dirs of the linked dir as well. Besides ls
the link to find out the linked dir, and then cd
into it, what are some simpler ways to accomplish that? For example, after cd
into a link, how do you change your current path to the path of the linked dir?
cd -P .
after the originalcd
. – ctrl-alt-delor Jul 27 '14 at 21:00