Skip to content
SimpleConvertSimpleConvert

Linux pwd Command

What pwd reports, the difference between the logical and physical path when symlinks are involved, and how to use it inside scripts.

Formula
pwd [-L | -P]

How to use it

  • The synopsis at the top shows the general form of the command.
  • Click any example to copy it straight to your clipboard.
  • The options table lists only the flags worth remembering — run man for the exhaustive list.

Examples

pwdprint the current directory
pwd -Pprint it with all symlinks resolved
echo "Working in $(pwd)"use it inside a script

Questions people ask

Why do pwd and pwd -P give different answers?

You reached the directory through a symlink. The default shows the path you took; -P shows where it really is on disk.

Is $PWD the same as pwd?

Nearly. $PWD is a shell variable holding the logical path, so it avoids spawning a process. pwd -P is the only way to force resolution.

Does this page work offline?

Yes, after the first visit. The whole reference is part of the page and the service worker caches it.

Runs entirely in your browser. Nothing you type is uploaded, logged or shared.

Last updated 22 August 2026