Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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 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).

share|improve this question
Meta: I believe you should have added the word "pwd" to the question's title. – esperanto Oct 3 '13 at 9:53
up vote 5 down vote accepted

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.

share|improve this answer
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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .