PWD(1) General Commands Manual PWD(1)

pwdprint working directory

pwd [-LP]

Writes the path to the current working directory, followed by a newline, to the standard output stream. This path is partially canonical — it doesn't contain . nor .. components.

, --logical
Use the PWD environment variable, if partially canonical and refers to the current working directory. If not, fall back to -P. This is the default.
, --physical
Just fully canonicalise the current working directory.

Used if valid and -L.

if the working directory no longer exists.

$ pwd
/home/cicada
$ pwd -P
/usr/home/cicada

$ PWD=/home/cicada//gachi/gachi/ pwd
/home/cicada//gachi/gachi/
$ pwd -P
/usr/home/cicada/gachi
$ PWD=/home/cicada/./gachi/gachi/ pwd
/usr/home/cicada/gachi
$ PWD=/ENOENT pwd
/usr/home/cicada/gachi

getcwd(3), environ(8)

You should prefer the PWD environment variable if you don't need -P.

Conforms to IEEE Std 1003.1-2008 (“POSIX.1”).

Appears in Version 5 AT&T UNIX, with no arguments, as pwd(I):

pwd - print working directory pathname

X/Open Portability Guide Issue 2 (“XPG2”) standardises it verbatim.

Version 3 of the Single UNIX Specification (“SUSv3”) adds -LP, as present-day, quoting a IEEE Std 1003.2 (“POSIX.2”) draft.

November 23, 2022 voreutils pre-v0.0.0-latest