pwd(1)

pwd1

Return working directory name

Usage

pwd [-LP]

Overview

The pwd utility prints the absolute pathname of the current working directory to the standard output.

The options are as follows:

-L

If the PWD environment variable is an absolute pathname that references the current directory and doesn't contain path components of "." or "..", then PWD is printed as the name of the current directory. Otherwise, act as if the -P option was given.

-P

Print the physical path to the current working directory, with symbolic links in the path resolved.

The -L and -P options override each other and the command's actions are determined by the last one specified. The default if no options are given is -P.

For an explanation of the directory hierarchy, see hier(7).

Environment

PWD

The presumptive logical path to the current working directory.

Exit status

The pwd utility exits 0 on success, and >0 if an error occurs.

Caveats

pwd also exists as a built-in to ksh(1), which may have a different default behavior.

Releases

61 releases since OpenBSD 2.1; the text changed 10 times.

  1. 2.1–2.3
  2. 2.4
  3. 2.5
  4. 2.6–3.3
  5. 3.4–3.6
  6. 3.7–4.1
  7. 4.2
  8. 4.3–4.4
  9. 4.5–4.8
  10. 4.9–5.5
  11. 5.6–8.0

-L since OpenBSD 5.6; -P since OpenBSD 5.6.

Standards

The pwd utility is compliant with the IEEE Std 1003.1-2008 (“POSIX.1”) specification, except the standard says the default if no options are given should be to behave as if -L had been specified.

History

An pwd utility appeared in Version 5 AT&T UNIX. Support for the -L option was added in OpenBSD 5.6.

From man 8.0-current-20261101 in OpenBSD 8.0-current (2026-11-01). Parsed by carta from the page's mdoc source.