]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - bin/pwd/pwd.1
ifconfig(8): wordsmith -G and -g descriptions
[FreeBSD/FreeBSD.git] / bin / pwd / pwd.1
1 .\"-
2 .\" Copyright (c) 1990, 1993
3 .\"     The Regents of the University of California.  All rights reserved.
4 .\"
5 .\" This code is derived from software contributed to Berkeley by
6 .\" the Institute of Electrical and Electronics Engineers, Inc.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\"    notice, this list of conditions and the following disclaimer in the
15 .\"    documentation and/or other materials provided with the distribution.
16 .\" 3. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .Dd May 22, 2023
33 .Dt PWD 1
34 .Os
35 .Sh NAME
36 .Nm pwd
37 .Nd return working directory name
38 .Sh SYNOPSIS
39 .Nm
40 .Op Fl L | P
41 .Sh DESCRIPTION
42 The
43 .Nm
44 utility writes the absolute pathname of the current working directory to
45 the standard output.
46 .Pp
47 Some shells may provide a builtin
48 .Nm
49 command which is similar or identical to this utility.
50 Consult the
51 .Xr builtin 1
52 manual page.
53 .Pp
54 The options are as follows:
55 .Bl -tag -width indent
56 .It Fl L
57 Display the logical current working directory.
58 .It Fl P
59 Display the physical current working directory (all symbolic links resolved).
60 .El
61 .Pp
62 If no options are specified, the
63 .Fl P
64 option is assumed.
65 .Sh ENVIRONMENT
66 Environment variables used by
67 .Nm :
68 .Bl -tag -width ".Ev PWD"
69 .It Ev PWD
70 Logical current working directory.
71 .El
72 .Sh EXIT STATUS
73 .Ex -std
74 .Sh EXAMPLES
75 Show current working directory with symbolic links resolved:
76 .Bd -literal -offset indent
77 $ /bin/pwd
78 /usr/src/sys/kern
79 .Ed
80 .Pp
81 Show the logical current directory.
82 Then use
83 .Xr file 1
84 to inspect the
85 .Pa /sys
86 directory:
87 .Bd -literal -offset indent
88 $ /bin/pwd -L
89 /sys/kern
90 $ file /sys
91 /sys: symbolic link to usr/src/sys
92 .Ed
93 .Sh SEE ALSO
94 .Xr builtin 1 ,
95 .Xr cd 1 ,
96 .Xr csh 1 ,
97 .Xr realpath 1 ,
98 .Xr sh 1 ,
99 .Xr getcwd 3
100 .Sh STANDARDS
101 The
102 .Nm
103 utility conforms to
104 .St -p1003.1-2001 .
105 .Sh HISTORY
106 The
107 .Nm
108 command appeared in
109 .At v5 .
110 .Sh BUGS
111 In
112 .Xr csh 1
113 the command
114 .Ic dirs
115 is always faster because it is built into that shell.
116 However, it can give a different answer in the rare case
117 that the current directory or a containing directory was moved after
118 the shell descended into it.
119 .Pp
120 The
121 .Fl L
122 option does not work unless the
123 .Ev PWD
124 environment variable is exported by the shell.