Results 1 to 6 of 6
Hey there
suppose i create a symlink to a directory music in /usr/local/goodies/music as
Code:
ln -s /usr/local/goodies/music music
this link has been created in my present dir ok. Now ...
- 05-12-2009 #1
Going into the parent dir of symlink
Hey there
suppose i create a symlink to a directory music in /usr/local/goodies/music as
this link has been created in my present dir ok. Now when I cd music I see the contents of /usr/local/goodies/music and pwd shows me ../music (which is inside the location where i created the link). Now after getting into usr/local/goodies/music using the link I can't go to goodies using cd.. . Is there a way to go to goodies form the symlink???Code:ln -s /usr/local/goodies/music music
Only if I could understand the man pages
Registered Linux user #492640
OS: RHEL4,5 ,RH 9,Ubuntu
- 05-13-2009 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
The Linux file system caches the path, so it will return you to the original directory and not /usr/local/goodies because it expects you to think you are navigating locally. Some Unix systems would not behave this way, and I always found it to be a real pain, because backing out of a link, I would find myself somewhere else!
However, you can use the -P option to the cd command, which will not follow the symbolic path, but will use the REAL path to the directory. So, if you execute the following command from your directory, you will be in /usr/local/goodies/music, and backing out with cd .. will put you in goodies: cd -P musicSometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 05-13-2009 #3
You can also use 'cd -' which will take you back to where you were before you used 'cd <dirname>'.
Linux user #126863 - see http://linuxcounter.net/
- 05-13-2009 #4
- 05-13-2009 #5Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
It will take you to the simlink'd directory, but then cd .. will take you up to the parent of that.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 05-18-2009 #6
ok finally cleared my concepts. If i do
without entering the symblink , then I go to the parent dir of the symblink. BUT when you enter inside the symblink and the issue this commandCode:cd -P MUSIC
then you go to the parent of the symblink ie the location where the syblink resides. So to go to the actual parent once inside the syblink issue this commandCode:cd - P
Hope this explains it.Code:cd -p .
Only if I could understand the man pages
Registered Linux user #492640
OS: RHEL4,5 ,RH 9,Ubuntu


Reply With Quote
