Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pwd(1) — SunOS 3.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cd(1)

csh(1)

PWD(1)  —  USER COMMANDS

NAME

pwd − print working directory name

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 command.  The example below illustrates the differences. 

 % cd  /usr/wendy/january/reports
 % pwd
 /usr/wendy/january/reports
 % dirs
 ~/january/reports
 % mv    ~/january   ~/february
 % pwd
 /usr/wendy/february/reports
 % dirs
 ~/january/reports
 %

pwd and dirs also give different answers when you change directory through a symbolic link.  For example:

 % cd  /usr/wendy/january/reports
 % pwd
 /usr/wendy/january/reports
 % dirs
 ~/january/reports
 % ls −l /usr/wendy/january
 lrwxrwxrwx  1 wendy          17 Jan 30  1983 /usr/wendy/january -> /usr/wendy/1984/jan/
 % cd  /usr/wendy/january
 % pwd
 /usr/wendy/1984/jan
 % dirs
 /usr/wendy/january

SEE ALSO

cd(1), csh(1)

Sun Release 3.2  —  Last change: 1 February 1985

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