Get back to original directory
Hi,
Sometimes I cd to a linked directory, and when I issue cd .., it takes me one level back, but not to the parent directory in which the link was there, but the true parent directory of the linked directory (I hope I could spell it clearly!). How to get back to the parent directory (the one which has the link) from within the linked directory? PS: even cd - does not help ~hatim |
The easiest way is to always know where you are at. Another way is instead of doing 'ls' for find the directories, do 'ls -l' so you can find the links and see where they go. Then you can do an 'ls' on the link location. i.e. 'ls <linklocation>'
|
Hello faizlo,
in bash the variable OLDPWD is the "old working directory". So Code:
cd $OLDPWD Markus |
On my system, "cd -" and "cd .." both take me back to where I was. If I drill down, cd ../.. also takes me to the original starting point. So......maybe this means there is a config file somewhere???
|
Hello together,
many Linuxdistributions come with the aliases Code:
alias ..='cd ..' and |
Quote:
|
Thank you all for the quick response (which make feel guilty of not posting before :) )
Markush, your trick worked. I will create an alias "back, or orig" and insert it in my .bashrc file. Thank you all again, ~faizlo |
cd $OLDPWD worked with bash, but not with tcsh :(
It say, OLDPWD: undefined variable. Any hints!? ~faizlo |
Hi,
in tcsh "cd -" should work (refering to the manpage). I'd recommend to read the manpage and search for "working" Code:
man tcsh Code:
/working |
On tcsh shells, the command is: cd $owd (small letters)
~faizlo |
All times are GMT -5. The time now is 03:43 AM. |