Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pwd(1) — SunOS 4.0.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cd(1)

csh(1)

PWD(1)  —  USER COMMANDS

NAME

pwd − display the pathname of the current working directory

SYNOPSIS

pwd

DESCRIPTION

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

SEE ALSO

cd(1), csh(1)

Sun Release 4.0  —  Last change: 22 March 1989

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026