Tag Info

Hot answers tagged

14

With POSIX shell, you can use -P option of cd builtin: cd -P <link> With bash, from man bash: The -P option says to use the physical directory structure instead of following symbolic links (see also the -P option to the set builtin command)


4

Shells keep track of symbolic links in the path to the current directory (this is known as logical current directory tracking). If you want to expand all symbolic links, pass the option -P to the cd builtin (for physical current directory tracking): cd -P logic If you're in a directory which you've accessed via a symbolic link and want to switch the ...


3

You can use readlink to determine where your link points, and provide this output as the target of your cd. cd "$(readlink <link>)" In the case of additional symlinks pointing to symlinks, readlink will simply provide the target, unless you specify one of it's options to follow symlinks to a canonical file target, for example readlink -f ...


3

As you have said, directory hard links are not possible. Perhaps you could move the original directory to a different location, such as a hidden folder, and make both of your directories soft links to the real location. That way you could rename them freely, and the links would still be valid. This shell alias may help: function mkdirlink { ...



Only top voted, non community-wiki answers of a minimum length are eligible