19ddb49cbSWarner Losh.\"- 24b88c807SRodney W. Grimes.\" Copyright (c) 1990, 1993 34b88c807SRodney W. Grimes.\" The Regents of the University of California. All rights reserved. 44b88c807SRodney W. Grimes.\" 54b88c807SRodney W. Grimes.\" This code is derived from software contributed to Berkeley by 64b88c807SRodney W. Grimes.\" the Institute of Electrical and Electronics Engineers, Inc. 74b88c807SRodney W. Grimes.\" 84b88c807SRodney W. Grimes.\" Redistribution and use in source and binary forms, with or without 94b88c807SRodney W. Grimes.\" modification, are permitted provided that the following conditions 104b88c807SRodney W. Grimes.\" are met: 114b88c807SRodney W. Grimes.\" 1. Redistributions of source code must retain the above copyright 124b88c807SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer. 134b88c807SRodney W. Grimes.\" 2. Redistributions in binary form must reproduce the above copyright 144b88c807SRodney W. Grimes.\" notice, this list of conditions and the following disclaimer in the 154b88c807SRodney W. Grimes.\" documentation and/or other materials provided with the distribution. 16fbbd9655SWarner Losh.\" 3. Neither the name of the University nor the names of its contributors 174b88c807SRodney W. Grimes.\" may be used to endorse or promote products derived from this software 184b88c807SRodney W. Grimes.\" without specific prior written permission. 194b88c807SRodney W. Grimes.\" 204b88c807SRodney W. Grimes.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 214b88c807SRodney W. Grimes.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 224b88c807SRodney W. Grimes.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 234b88c807SRodney W. Grimes.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 244b88c807SRodney W. Grimes.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 254b88c807SRodney W. Grimes.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 264b88c807SRodney W. Grimes.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 274b88c807SRodney W. Grimes.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 284b88c807SRodney W. Grimes.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 294b88c807SRodney W. Grimes.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 304b88c807SRodney W. Grimes.\" SUCH DAMAGE. 314b88c807SRodney W. Grimes.\" 32*10823074SMike Karels.Dd May 22, 2023 334b88c807SRodney W. Grimes.Dt PWD 1 34caa2db3bSRuslan Ermilov.Os 354b88c807SRodney W. Grimes.Sh NAME 364b88c807SRodney W. Grimes.Nm pwd 374b88c807SRodney W. Grimes.Nd return working directory name 384b88c807SRodney W. Grimes.Sh SYNOPSIS 39be8b1497SRuslan Ermilov.Nm 40d74e011fSRuslan Ermilov.Op Fl L | P 414b88c807SRodney W. Grimes.Sh DESCRIPTION 42e004acc8SPhilippe CharnierThe 43e004acc8SPhilippe Charnier.Nm 44e004acc8SPhilippe Charnierutility writes the absolute pathname of the current working directory to 454b88c807SRodney W. Grimesthe standard output. 46c644db6aSSheldon Hearn.Pp 47c644db6aSSheldon HearnSome shells may provide a builtin 48c644db6aSSheldon Hearn.Nm 49e6d3cf26SSheldon Hearncommand which is similar or identical to this utility. 50e6d3cf26SSheldon HearnConsult the 51c644db6aSSheldon Hearn.Xr builtin 1 52c644db6aSSheldon Hearnmanual page. 537a396ef4SMike Barcroft.Pp 547a396ef4SMike BarcroftThe options are as follows: 557a396ef4SMike Barcroft.Bl -tag -width indent 567a396ef4SMike Barcroft.It Fl L 577a396ef4SMike BarcroftDisplay the logical current working directory. 587a396ef4SMike Barcroft.It Fl P 597a396ef4SMike BarcroftDisplay the physical current working directory (all symbolic links resolved). 607a396ef4SMike Barcroft.El 617a396ef4SMike Barcroft.Pp 627a396ef4SMike BarcroftIf no options are specified, the 631e7e78dcSTim J. Robbins.Fl P 647a396ef4SMike Barcroftoption is assumed. 657a396ef4SMike Barcroft.Sh ENVIRONMENT 667a396ef4SMike BarcroftEnvironment variables used by 677a396ef4SMike Barcroft.Nm : 681640d4e0SRuslan Ermilov.Bl -tag -width ".Ev PWD" 697a396ef4SMike Barcroft.It Ev PWD 707a396ef4SMike BarcroftLogical current working directory. 717a396ef4SMike Barcroft.El 726fca4c7cSRuslan Ermilov.Sh EXIT STATUS 73d628d776SRuslan Ermilov.Ex -std 7464e352c6SFernando Apesteguía.Sh EXAMPLES 7564e352c6SFernando ApesteguíaShow current working directory with symbolic links resolved: 7664e352c6SFernando Apesteguía.Bd -literal -offset indent 7764e352c6SFernando Apesteguía$ /bin/pwd 78*10823074SMike Karels/usr/src/sys/kern 7964e352c6SFernando Apesteguía.Ed 8064e352c6SFernando Apesteguía.Pp 8164e352c6SFernando ApesteguíaShow the logical current directory. 8264e352c6SFernando ApesteguíaThen use 8364e352c6SFernando Apesteguía.Xr file 1 8464e352c6SFernando Apesteguíato inspect the 85*10823074SMike Karels.Pa /sys 8664e352c6SFernando Apesteguíadirectory: 8764e352c6SFernando Apesteguía.Bd -literal -offset indent 8864e352c6SFernando Apesteguía$ /bin/pwd -L 89*10823074SMike Karels/sys/kern 90*10823074SMike Karels$ file /sys 91*10823074SMike Karels/sys: symbolic link to usr/src/sys 9264e352c6SFernando Apesteguía.Ed 934b88c807SRodney W. Grimes.Sh SEE ALSO 94c644db6aSSheldon Hearn.Xr builtin 1 , 954b88c807SRodney W. Grimes.Xr cd 1 , 964b88c807SRodney W. Grimes.Xr csh 1 , 9764e352c6SFernando Apesteguía.Xr realpath 1 , 985521ff5aSRuslan Ermilov.Xr sh 1 , 995521ff5aSRuslan Ermilov.Xr getcwd 3 1006fca4c7cSRuslan Ermilov.Sh STANDARDS 1016fca4c7cSRuslan ErmilovThe 1026fca4c7cSRuslan Ermilov.Nm 1036fca4c7cSRuslan Ermilovutility conforms to 1046fca4c7cSRuslan Ermilov.St -p1003.1-2001 . 10525907b31SSevan Janiyan.Sh HISTORY 10625907b31SSevan JaniyanThe 10725907b31SSevan Janiyan.Nm 10825907b31SSevan Janiyancommand appeared in 10925907b31SSevan Janiyan.At v5 . 1104b88c807SRodney W. Grimes.Sh BUGS 1114b88c807SRodney W. GrimesIn 1124b88c807SRodney W. Grimes.Xr csh 1 1134b88c807SRodney W. Grimesthe command 1144b88c807SRodney W. Grimes.Ic dirs 115e6d3cf26SSheldon Hearnis always faster because it is built into that shell. 116e6d3cf26SSheldon HearnHowever, it can give a different answer in the rare case 1174b88c807SRodney W. Grimesthat the current directory or a containing directory was moved after 118c644db6aSSheldon Hearnthe shell descended into it. 1197a396ef4SMike Barcroft.Pp 1207a396ef4SMike BarcroftThe 1217a396ef4SMike Barcroft.Fl L 1227a396ef4SMike Barcroftoption does not work unless the 1237a396ef4SMike Barcroft.Ev PWD 1247a396ef4SMike Barcroftenvironment variable is exported by the shell. 125