I am going through and old .cshrc file and it contains the following alias:

alias pwd 'echo $cwd'

How is that useful?

I used to think that this is how pwd might have been implemented. But looks like thats not the case (because then this alias is meaningless).

  • Meta: I believe you should have added the word "pwd" to the question's title. – Raúl Salinas-Monteagudo Oct 3 '13 at 9:53


This mailing list archive shows the subtle differences between the two that existed in 1996. Not sure if they still exist now, but since you mentioned an old file...

Basically, cwd only prints out where csh thinks it is, instead of the absolute path that pwd will figure out.

To quote Scott Williamson in that thread:

Yes, the difference is that $cwd will give you the path that the shell took to get to that directory because it doesn't know any better. pwd will give the real physical directory because it starts at the current directory and works back up the hierarchy. So symbolic links and mounting or re-mounting directories will confuse $cwd.

| improve this answer | |
  • 1
    The Mac OS version of pwd has a -L switch that displays the current working directory without resolving symbolic links. – zneak Aug 2 '10 at 19:11

At least under Mac OS, there is a program called pwd in /bin, and it works with tcsh no problem. It's probably there under Linux too.

I suggest you unalias pwd and check with which pwd if you have a replacement.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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