pwd prints the pathname of the working (current) directory.
If you are using csh.1 you can use the dirs builtin command to do the same job more quickly; but dirs can give a different answer in the rare case that the current directory or a containing directory was moved after the shell descended into it. This is because pwd searches back up the directory tree to report the true pathname, whereas dirs remembers the pathname from the last cd.1 command. The example below illustrates the differences.
example% cd /usr/wendy/january/reports example% pwd /usr/wendy/january/reports example% dirs ~/january/reports example% mv ~/january ~/february example% pwd /usr/wendy/february/reports example% dirs ~/january/reports example%
pwd and dirs also give different answers when you change directory through a symbolic link. For example:
example% cd /usr/wendy/january/reports example% pwd /usr/wendy/january/reports example% dirs ~/january/reports example% ls -l /usr/wendy/january lrwxrwxrwx 1 wendy 17 Jan 30 1983 /usr/wendy/january -> /usr/wendy/1984/jan/ example% cd /usr/wendy/january example% pwd /usr/wendy/1984/jan example% dirs /usr/wendy/january
The pathnames of files mounted with the Automounter can also change if the file is not used for a certain time interval (the default is five minutes). To prevent this, set the environment variable AUTOMOUNT_FIXNAMES. See automount.8 for more information.
Created by unroff & hp-tools. © somebody (See intro for details). All Rights Reserved. Last modified 11/5/97