Glossary

pwd

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.

Related terms: cd, ls, Shell

Discussed in:

This site is currently in Beta. Contact: Chris Paton

Textbook of AI · Textbook of Usability · Textbook of Digital Health

Auckland Maths and Science Tutoring

AI tools used: Claude (research, coding, text), ChatGPT (diagrams, images), Grammarly (editing).