xref: /openbsd/bin/pwd/pwd.1 (revision a6445c1d)
1.\"	$OpenBSD: pwd.1,v 1.21 2014/05/28 14:16:27 jmc Exp $
2.\"	$NetBSD: pwd.1,v 1.10 1995/09/07 06:47:30 jtc Exp $
3.\"
4.\" Copyright (c) 1990, 1993
5.\"	The Regents of the University of California.  All rights reserved.
6.\"
7.\" This code is derived from software contributed to Berkeley by
8.\" the Institute of Electrical and Electronics Engineers, Inc.
9.\"
10.\" Redistribution and use in source and binary forms, with or without
11.\" modification, are permitted provided that the following conditions
12.\" are met:
13.\" 1. Redistributions of source code must retain the above copyright
14.\"    notice, this list of conditions and the following disclaimer.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice, this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\" 3. Neither the name of the University nor the names of its contributors
19.\"    may be used to endorse or promote products derived from this software
20.\"    without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32.\" SUCH DAMAGE.
33.\"
34.\"     @(#)pwd.1	8.2 (Berkeley) 4/28/95
35.\"
36.Dd $Mdocdate: May 28 2014 $
37.Dt PWD 1
38.Os
39.Sh NAME
40.Nm pwd
41.Nd return working directory name
42.Sh SYNOPSIS
43.Nm pwd
44.Op Fl LP
45.Sh DESCRIPTION
46The
47.Nm
48utility prints the absolute pathname of the current working directory to
49the standard output.
50.Pp
51The options are as follows:
52.Bl -tag -width Ds
53.It Fl L
54If the
55.Ev PWD
56environment variable is an absolute pathname that references the
57current directory and doesn't contain path components of "." or "..",
58then
59.Ev PWD
60is printed as the name of the current directory.
61Otherwise, act as if the
62.Fl P
63option was given.
64.It Fl P
65Print the physical path to the current working directory, with symbolic
66links in the path resolved.
67.El
68.Pp
69The
70.Fl L
71and
72.Fl P
73options override each other and the command's actions are determined
74by the last one specified.
75The default if no options are given is
76.Fl P .
77.Pp
78For an explanation of the directory hierarchy,
79see
80.Xr hier 7 .
81.Sh ENVIRONMENT
82.Bl -tag -width PWD
83.It Ev PWD
84The presumptive logical path to the current working directory.
85.El
86.Sh EXIT STATUS
87.Ex -std pwd
88.Sh SEE ALSO
89.Xr ksh 1 ,
90.Xr getcwd 3 ,
91.Xr hier 7
92.Sh STANDARDS
93The
94.Nm
95utility is compliant with the
96.St -p1003.1-2008
97specification,
98except the standard says the default if no options are given
99should be to behave as if
100.Fl L
101had been specified.
102.Sh HISTORY
103An
104.Nm
105utility appeared in
106.At v5 .
107Support for the
108.Fl L
109option was added in
110.Ox 5.6 .
111.Sh CAVEATS
112.Nm
113also exists as a built-in to
114.Xr ksh 1 ,
115which may have a different default behavior.
116