Change Directory to Symbolic Link Path – How to

bash

I'm currently in a symbolic link directory and I want to go up one level in the absolute path, but I cant as it will hit me back up to my home directory (~). I can do pwd -P to get the absolute path, but how do I pipe that result into the cd command? I always thought it was this: {}

Sample:

10:21:55 {master *} ~/ch$ pwd -P 
/home/drupal/sites/all/themes/house

10:22:16 {master *} ~/ch$ pwd -P | cd {}
bash: cd: {}: No such file or directory

10:22:20 {master *} ~/ch$ 

Best Answer

This works for me:

cd `pwd -P`

You can also use cd -P like this:

cd -P ~/ch

or if you're already in the symlinked directory:

cd -P .
Related Question