pwd ("print working directory") outputs the absolute path of the shell's current directory. It is a shell builtin, though /bin/pwd also exists for scripting outside a shell.
pwd # /home/alice/projects
pwd -P # resolve symlinks, print physical path
pwd -L # print logical path (default)
The shell variable $PWD` holds the same value and is slightly faster to reference in scripts. `$OLDPWD holds the previous directory, letting cd - toggle between the two.
Discussed in:
- Chapter 6: Files, Directories, and Pathnames — Where Am I?