Pwd

Shell command that reports the working directory
title: "Pwd" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["multics-commands", "unix-sus2008-utilities", "plan-9-commands", "inferno-(operating-system)-commands", "ibm-i-qshell-commands", "file-system-directories"] description: "Shell command that reports the working directory" topic_path: "technology/operating-systems" source: "https://en.wikipedia.org/wiki/Pwd" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0
::summary Shell command that reports the working directory ::
::data[format=table title="Infobox software"]
| Field | Value |
|---|---|
| name | pwd |
| screenshot | Pwdkommando.png |
| caption | The pwd command |
| author | AT&T Bell Laboratories |
| developer | Various open-source and commercial developers |
| released | |
| programming language | C |
| operating system | Multics, Unix, Unix-like, V, Plan 9, Inferno, SpartaDOS X, PANOS, Windows CE, KolibriOS |
| platform | Cross-platform |
| genre | Command |
| license | coreutils: GPLv3+ |
| Plan 9: MIT License | |
| :: |
| name = pwd
| logo =
| screenshot = Pwdkommando.png
| screenshot size =
| caption = The pwd command
| author = AT&T Bell Laboratories
| developer = Various open-source and commercial developers
| released =
| latest release version =
| latest release date =
| programming language = C
| operating system = Multics, Unix, Unix-like, V, Plan 9, Inferno, SpartaDOS X, PANOS, Windows CE, KolibriOS
| platform = Cross-platform
| genre = Command
| license = coreutils: GPLv3+
Plan 9: MIT License
| website =
**pwd** (print working directory) is a shell command that reports the working directory path to standard output.
Although often associated with Unix, its predecessor Multics had a pwd command (which was a short name of the print_wdir command) from which the Unix command originated. The command is part of the X/Open Portability Guide since issue 2 of 1987. It was inherited into the first version of POSIX.1 and the Single Unix Specification. It appeared in Version 5 Unix. The version bundled in GNU Core Utilities was written by Jim Meyering.
The command is available in other shells and operating systems including SpartaDOS X, PANOS, and KolibriOS. PowerShell provides as an alias for the cmdlet Get-Location. An equivalent command in COMMAND.COM and Command Prompt is the [cd](cd-command) command with no arguments. On Windows CE 5.0, cmd.exe includes a pwd command. The OpenVMS equivalent is show default.
The numerical computing environments MATLAB and GNU Octave include a pwd
function with similar functionality.
The command is implemented as a shell builtin in many Unix shells including sh, ash, bash, ksh, and zsh. It can be implemented with the POSIX getcwd() or getwd() functions.
Examples
The following examples are based on a typical Unix-based implementation.
With no arguments, the command writes the working directory path to the terminal:
$ cd /home/example $ pwd /home/example
Display the working directory without any symbolic link info. If at a directory /home/symlinked that is a symlink to /home/realdir:
$ cd /home/symlinked $ pwd -P /home/realdir
Display the working directory with symbolic link info. Note: POSIX requires that the default behavior be as if the -L switch were provided.
$ pwd -L /home/symlinked
Shell variables
POSIX shells set the following environment variables while using the command:
; OLDPWD : The previous working directory ; PWD : The current working directory
References
References
- "pwd(1) [minix man page]".
- "pwd - print name of current/working directory - man page".
- "GNU Coreutils".
- (January 1979). "Unix Time-Sharing System: Unix Programmer's Manual". [[Bell labs]].
- "pwd(1) [plan9 man page]".
- "pwd".
- "pwd(1) [osf1 man page]".
- "Apple OS X MAN page".
- "pwd(1) - OpenBSD manual pages".
- "pwd(1) [opensolaris man page]".
- "working_dir, wd, print_wdir, pwd (Multics help segment)".
- "Unix and Multics".
- {{man. cu. wc. SUS
- {{man. 1. pwd. FreeBSD
- {{man. 1. pwd. Linux
- "SpartaDOS X 4.48 User Guide".
- "Chris's Acorns: Panos".
- "Shell - KolibriOS wiki".
- "Command Processor Commands (Windows CE 5.0)".
- "Identify current folder - MATLAB pwd".
- "Function Reference: pwd".
- "cd".
::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::