Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to figure out how to tell the shell (tcsh) to remember when I've gone into a symlinked folder, and allow 'cd ..' to navigate back out of the symlink rather than just navigate to the parent directory of the linked-to folder...

For example:

$ ls -al /jobs
tech -> /mnt/projects1/tech
temp -> /mnt/projects2/temp

$ cd /jobs/tech
$ cd ../temp
../temp: No such file or directory.

$ pwd

Any idea how to do this? I have a feeling that it's a shell setting that you can set somewhere....


share|improve this question
updated my answer to be probably more what you're looking for...haven't tested it yet – RobotHumans Dec 10 '10 at 13:39
up vote 2 down vote accepted

if you don't have to do it for more than one "step" you could use cd - instead

so it looks like setting the symlink env variable to ignore might get your desired response
from the man page:

symlinks (+) Can be set to several different values to control symbolic link ('symlink') resolution:

If set to 'chase', whenever the current directory changes to a directory containing a symbolic link, it is expanded to the real name of the directory to which the link points. This does not work for the user's home directory; this is a bug.

If set to 'ignore', the shell tries to construct a current directory relative to the current directory before the link was crossed. This means that cding through a symbolic link and then 'cd ..'ing returns one to the original directory. This affects only builtin commands and filename completion.

If set to 'expand', the shell tries to fix symbolic links by actually expanding arguments which look like path names. This affects any command, not just builtins. Unfortunately, this does not work for hard-to-recognize filenames, such as those embedded in command options. Expansion may be prevented by quoting. While this setting is usually the most convenient, it is sometimes misleading and sometimes confusing when it fails to recognize an argument which should be expanded. A compro- mise is to use `ignore' and use the editor command normalize- path (bound by default to ^X-n) when necessary.

share|improve this answer
That's been my method so far, but it's not an ideal workflow... – Hugh Dec 10 '10 at 13:31
I think we both found the same answer at the same time there! :D – Hugh Dec 10 '10 at 13:40
looks like, give yourself the check – RobotHumans Dec 10 '10 at 13:41
Nah, it's yours... I should have done a search through the manpage before posting on here in the first place... Cheers! – Hugh Dec 10 '10 at 20:31

I think I've just managed to answer my own question here, at least for tcsh, anyway...

On the tcsh manpage, it talks about the 'symlinks' variable...

So, I can now do:

$ set symlinks=expand

$ cd /jobs/tech
$ pwd
$ echo $cwd

$ cd ..
$ echo $cwd

Because of all of this, I'm quite tempted to just alias pwd to 'echo $cwd', as it'll give the user a more accurate view of where they can consider themselves to be in the filesystem...

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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