pwd (Unix)
pwd (abbreviation for English print working directory 'show current directory' ) is a program to output the path of the directory that the calling process is currently using, provided no explicit path is specified (so to speak, the "current location" in the file system). This calling process can be an interactive shell but also a script or the like. The behavior of the command is specified in the POSIX standard for UNIX systems and its presence is prescribed for UNIX systems; similar systems usually also have this command.
The output corresponds to the POSIX -compliant system functions getcwd()
or (obsolete) getwd()
and can be easily implemented with these.
functionality
The behavior of the program is standardized in the POSIX standard; the definition refers to the XBD Utility Syntax Guidelines .
Example:
$ pwd /home/foobar
Arguments and options
By specifying the options -L
or -P
, the output of the logical or physical path can be forced. The physical path differs from the logical path if the logical path contains symlinks .
If no option is specified, -L
the default is according to the POSIX standard ; if more than one option is used, the latter takes effect.
The following example is /home
a symbolic link to /mnt/home
:
$ pwd /home/foobar $ pwd -L /home/foobar $ pwd -P /mnt/home/foobar $ ls -ld /home lrwxrwxrwx 1 root root 10 10. Dez 05:06 /home -> /mnt/home
Analogues
Shells
pwd
Derived from the function of the command , many shells ( Kornshell , but also bash ) have an automatically updated variable PWD
, the content of which pwd -P
corresponds to the output of .
Other operating systems
Similar commands can also be found in other operating systems , such as Windows ( chdir
without arguments) or OpenVMS ( show default
).
Web links
-
pwd(1)
- Open Group Base Specification -
pwd(1)
- Debian GNU / Linux executables or shell commands man page -
pwd(1)
- OpenBSD General Commands Manual
Individual evidence
- ↑ a b pwd, The Open Group Base Specifications. Issue 7, 2018 edition.
- ↑ getcwd (), The Open Group Base Specifications. Issue 7, 2018 edition.
- ↑ getwd (), The Open Group Base Specifications. Issue 6, 2004 edition.
- ^ The Open Group Base Specifications, 12.2 Utility Syntax Guidelines. Issue 7, 2018 edition.