1

This question already has an answer here:

I have following symlink in my home directory.

lrwxrwxrwx 1 mtk mtk   43 Aug  8 20:35 tripple-bit -> /media/mtk/study/Collage/docs

I use the symlink to navigate to the docs folder directly. But now, while being in docs folder, I want to move to it's parent directory i.e. /media/mtk/study/Collage in this case.

How can I achieve this?

On giving cd .., it comes back to the home directory and not the parent directory.

marked as duplicate by cuonglm, don_crissti, Stephen Kitt, chaos, jimmij Aug 12 '15 at 21:22

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Try cd -P. The -P option tells cd to use the physical directory layout when resolving relative paths. – hrunting Aug 12 '15 at 14:07
  • 1
    And just for completness cd -L .. is other way around - change directory logically. – jimmij Aug 12 '15 at 14:08
  • What shell? this is a shell question not a kernel question. – ctrl-alt-delor Aug 12 '15 at 14:55
2

Just use:

cd -P ..

From the bash manpage:

The -P option says to use the physical directory structure instead of following symbolic links.

Not the answer you're looking for? Browse other questions tagged or ask your own question.