pwd (Unix)

from Wikipedia, the free encyclopedia

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 -Lor -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, -Lthe default is according to the POSIX standard ; if more than one option is used, the latter takes effect.

The following example is /homea 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

pwdDerived from the function of the command , many shells ( Kornshell , but also bash ) have an automatically updated variable PWD, the content of which pwd -Pcorresponds to the output of .

Other operating systems

Similar commands can also be found in other operating systems , such as Windows ( chdirwithout arguments) or OpenVMS ( show default).

Web links

Individual evidence

  1. a b pwd, The Open Group Base Specifications. Issue 7, 2018 edition.
  2. getcwd (), The Open Group Base Specifications. Issue 7, 2018 edition.
  3. getwd (), The Open Group Base Specifications. Issue 6, 2004 edition.
  4. ^ The Open Group Base Specifications, 12.2 Utility Syntax Guidelines. Issue 7, 2018 edition.