1PWD(1P)                    POSIX Programmer's Manual                   PWD(1P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       pwd - return working directory name
13

SYNOPSIS

15       pwd [-L | -P ]
16

DESCRIPTION

18       The pwd utility shall write to standard output an absolute pathname  of
19       the current working directory, which does not contain the filenames dot
20       or dot-dot.
21

OPTIONS

23       The pwd utility  shall  conform  to  the  Base  Definitions  volume  of
24       IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.
25
26       The following options shall be supported by the implementation:
27
28       -L     If the PWD environment variable contains an absolute pathname of
29              the current directory that does not contain the filenames dot or
30              dot-dot,  pwd shall write this pathname to standard output. Oth‐
31              erwise, the -L option shall behave as the -P option.
32
33       -P     The absolute pathname written shall not contain filenames  that,
34              in  the context of the pathname, refer to files of type symbolic
35              link.
36
37
38       If both -L and -P are specified, the last one shall apply.  If  neither
39       -L  nor -P is specified, the pwd utility shall behave as if -L had been
40       specified.
41

OPERANDS

43       None.
44

STDIN

46       Not used.
47

INPUT FILES

49       None.
50

ENVIRONMENT VARIABLES

52       The following environment variables shall affect the execution of pwd:
53
54       LANG   Provide a default value for the  internationalization  variables
55              that  are  unset  or  null.  (See the Base Definitions volume of
56              IEEE Std 1003.1-2001, Section  8.2,  Internationalization  Vari‐
57              ables  for the precedence of internationalization variables used
58              to determine the values of locale categories.)
59
60       LC_ALL If set to a non-empty string value, override the values  of  all
61              the other internationalization variables.
62
63       LC_MESSAGES
64              Determine  the  locale  that should be used to affect the format
65              and contents of diagnostic messages written to standard error.
66
67       NLSPATH
68              Determine the location of message catalogs for the processing of
69              LC_MESSAGES .
70
71       PWD    If  the -P option is in effect, this variable shall be set to an
72              absolute pathname of the current working directory that does not
73              contain  any  components  that  specify symbolic links, does not
74              contain any components that are dot, and does  not  contain  any
75              components  that  are  dot-dot. If an application sets or unsets
76              the value of PWD,  the behavior of pwd is unspecified.
77
78

ASYNCHRONOUS EVENTS

80       Default.
81

STDOUT

83       The pwd utility output is an absolute pathname of the  current  working
84       directory:
85
86
87              "%s\n", <directory pathname>
88

STDERR

90       The standard error shall be used only for diagnostic messages.
91

OUTPUT FILES

93       None.
94

EXTENDED DESCRIPTION

96       None.
97

EXIT STATUS

99       The following exit values shall be returned:
100
101        0     Successful completion.
102
103       >0     An error occurred.
104
105

CONSEQUENCES OF ERRORS

107       If  an  error is detected, output shall not be written to standard out‐
108       put, a diagnostic message shall be written to standard error,  and  the
109       exit status is not zero.
110
111       The following sections are informative.
112

APPLICATION USAGE

114       None.
115

EXAMPLES

117       None.
118

RATIONALE

120       Some  implementations have historically provided pwd as a shell special
121       built-in command.
122
123       In most utilities, if an error occurs, partial output may be written to
124       standard  output. This does not happen in historical implementations of
125       pwd. Because pwd is frequently used in historical shell scripts without
126       checking  the exit status, it is important that the historical behavior
127       is required here; therefore, the CONSEQUENCES OF ERRORS section specif‐
128       ically disallows any partial output being written to standard output.
129

FUTURE DIRECTIONS

131       None.
132

SEE ALSO

134       cd, the System Interfaces volume of IEEE Std 1003.1-2001, getcwd()
135
137       Portions  of  this text are reprinted and reproduced in electronic form
138       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
139       --  Portable  Operating  System  Interface (POSIX), The Open Group Base
140       Specifications Issue 6, Copyright (C) 2001-2003  by  the  Institute  of
141       Electrical  and  Electronics  Engineers, Inc and The Open Group. In the
142       event of any discrepancy between this version and the original IEEE and
143       The  Open Group Standard, the original IEEE and The Open Group Standard
144       is the referee document. The original Standard can be  obtained  online
145       at http://www.opengroup.org/unix/online.html .
146
147
148
149IEEE/The Open Group                  2003                              PWD(1P)
Impressum