In
Unix-like
A Unix-like (sometimes referred to as UN*X or *nix) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Unix-li ...
and some other
operating system
An operating system (OS) is system software that manages computer hardware, software resources, and provides common services for computer programs.
Time-sharing operating systems schedule tasks for efficient use of the system and may also in ...
s, the
pwd
command
Command may refer to:
Computing
* Command (computing), a statement in a computer language
* COMMAND.COM, the default operating system shell and command-line interpreter for DOS
* Command key, a modifier key on Apple Macintosh computer keyboards
* ...
(''print working directory'')
writes the full
pathname of the current
working directory to the
standard output.
Implementations
Multics
Multics ("Multiplexed Information and Computing Service") is an influential early time-sharing operating system based on the concept of a single-level memory.Dennis M. Ritchie, "The Evolution of the Unix Time-sharing System", Communications of t ...
had a
pwd
command (which was a short name of the
print_wdir
command) from which the Unix pwd command originated. The command is a
shell builtin
In computing, a shell builtin is a command or a function, called from a shell, that is executed directly in the shell itself, instead of an external executable program which the shell would load and execute.
Shell builtins work significantly fast ...
in most
Unix shells such as
Bourne shell
The Bourne shell (sh) is a Shell (computing), shell Command-line interface#Command-line interpreter, command-line interpreter for computer operating systems.
The Bourne shell was the default Unix shell, shell for Version 7 Unix. Unix-like syste ...
,
ash
Ash or ashes are the solid remnants of fires. Specifically, ''ash'' refers to all non-aqueous, non- gaseous residues that remain after something burns. In analytical chemistry, to analyse the mineral and metal content of chemical samples, ash ...
,
bash
Bash or BASH may refer to:
Arts and entertainment
* ''Bash!'' (Rockapella album), 1992
* ''Bash!'' (Dave Bailey album), 1961
* '' Bash: Latter-Day Plays'', a dramatic triptych
* ''BASH!'' (role-playing game), a 2005 superhero game
* "Bash" ('' ...
,
ksh, and
zsh
The Z shell (Zsh) is a Unix shell that can be used as an interactive login shell (computing), shell and as a command line interpreter, command interpreter for shell scripting. Zsh is an extended Bourne shell with many improvements, including som ...
. It can be implemented easily with the
POSIX
The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines both the system- and user-level application programming interf ...
C functions
getcwd()
or
getwd()
.
It is also available in the operating systems
SpartaDOS X
SpartaDOS X (or SpartaDOS 4.0) is a disk operating system for the Atari 8-bit family of computers that closely resembles MS-DOS. It was developed and sold by ICD, Inc. in 1987-1993, and many years later picked up by the third-party community S ...
,
PANOS, and
KolibriOS
KolibriOS, or Kolibri, is a small, open-source x86 operating system written completely in assembly. It was forked from MenuetOS in 2004 and has run under independent development since.
In a 2009 review piece on alternative operating systems, ''T ...
. The equivalent on
DOS (
COMMAND.COM
COMMAND.COM is the default command-line interpreter for MS-DOS, Windows 95, Windows 98 and Windows Me. In the case of DOS, it is the default user interface as well. It has an additional role as the usual first program run after boot (init proc ...
) and
Microsoft Windows
Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for serv ...
(
cmd.exe
) is the
cd
command with no arguments.
Windows PowerShell
PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell and the associated scripting language. Initially a Windows component only, known as Windows PowerShell, it was made open-sourc ...
provides the equivalent
Get-Location
cmdlet
PowerShell is a task automation and configuration management program from Microsoft, consisting of a command-line shell and the associated scripting language. Initially a Windows component only, known as Windows PowerShell, it was made open-sourc ...
with the standard aliases
gl
and
pwd
.
On
Windows CE 5.0, the
cmd.exe
''Command Processor Shell'' includes the
pwd
command.
as found on Unix systems 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 of
pwd
bundled in
GNU coreutils was written by Jim Meyering.
The
numerical computing environments
MATLAB
MATLAB (an abbreviation of "MATrix LABoratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementation ...
and
GNU Octave
GNU Octave is a high-level programming language primarily intended for scientific computing and numerical computation. Octave helps in solving linear and nonlinear problems numerically, and for performing other numerical experiments using a langu ...
include a
pwd
function with similar functionality. The
OpenVMS
OpenVMS, often referred to as just VMS, is a multi-user, multiprocessing and virtual memory-based operating system. It is designed to support time-sharing, batch processing, transaction processing and workstation applications. Customers using Ope ...
equivalent is
show default
.
*nix examples
Note: POSIX requires that the default behavior be as if the
-L
switch were provided.
Working directory shell variables
POSIX shells set the following
environment variables while using the cd command:
; OLDPWD : The previous working directory (as set by the cd command).
; PWD : The current working directory (as set by the cd command).
See also
*
Breadcrumb (navigation)
A breadcrumb or breadcrumb trail is a graphical control element used as a navigational aid in user interfaces and on web pages. It allows users to keep track and maintain awareness of their locations within programs, documents, or websites. The t ...
, an alternative way of displaying the work directory
*
List of GNU Core Utilities commands
This is a list of commands from the GNU Core Utilities for Unix environments. These commands can be found on Unix operating systems and most Unix-like operating systems.
List
See also
* List of Unix commands
* List of GNOME applications
* List o ...
*
List of Unix commands
*
pushd
and popd
References
Further reading
*
External links
*
*
*
*
*
*
*
*
{{Core Utilities commands
Multics commands
Unix SUS2008 utilities
Plan 9 commands
Inferno (operating system) commands
IBM i Qshell commands
File system directories