Go to main content

man pages section 1: User Commands

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

pwd(1)

Name

pwd - return working directory name

Synopsis

/usr/bin/pwd [-LP ] [--logical] [--physical] [--help]

Description

The pwd utility writes an absolute path name of the current working directory to standard output.

Both the Bourne shell, sh(1), and the Korn shells, ksh(1) and ksh88(1), also have a built-in pwd command.

Options

The following options are supported:

–P, –-physical

Display the physical name of the working directory. This is the default option if none is specified.

–L, –-logical

Use the PWD environment variable as the name of the working directory, if possible, even if it is a symbolic link. PWD must not contain “dot” or “dot-dot” components and must point to the current working directory if it is a symbolic link. If these conditions are not met, –P behavior is assumed.

–-help

Display command usage and exit.

If both –L and –P are specified, only the last entered option will apply.

Environment Variables

See environ(7) for descriptions of the following environment variables that affect the execution of pwd: LANG, LC_ALL , LC_MESSAGES, and NLSPATH.

Exit Status

The following exit values are returned:

0

Successful completion.

>0

An error occurred.

If an error is detected, output will not be written to standard output, a diagnostic message will be written to standard error, and the exit status will not be 0.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
system/core-os
CSI
Enabled
Interface Stability
Committed
Standard

See Also

cd(1), ksh(1), ksh88(1), sh(1), shell_builtins(1), attributes(7), environ(7), standards(7)

Diagnostics

pwd: cannot determine current directory!

Consult your network administrator.

Notes

If you move the current directory or one above it, pwd may not give the correct response. Use the cd(1) command with a full path name to correct this situation.