NAME
pwd
—
print working directory
SYNOPSIS
pwd |
[-LP ] |
DESCRIPTION
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.
OPTIONS
-L
,--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. -P
,--physical
- Just fully canonicalise the current working directory.
ENVIRONMENT
PWD
- Used if valid and
-L
.
EXIT STATUS
1 if the working directory no longer exists.
EXAMPLES
$
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
=
/ENOENTpwd
/usr/home/cicada/gachi
SEE ALSO
You should prefer the PWD
environment
variable if you don't need -P
.
STANDARDS
Conforms to IEEE Std 1003.1-2008 (“POSIX.1”).
HISTORY
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.