Print the full absolute path of the current working directory.
low risk
pwd resolves and prints the absolute path. -P shows the physical path resolving symlinks, useful after cd-ing through symlinked directories. The $PWD variable is always available as an alternative.
| Flag | Meaning |
|---|---|
-P --physical | Print real physical path, resolving all symlinks |
-L --logical | Use shell logical path including symlinks (default) |
pwdShow current directory · explain & risk-check →pwd -PShow real path resolving any symlinks · explain & risk-check →SCRIPT_DIR=$(pwd)Capture current directory into a variable in a script · explain & risk-check →In bash scripts use `$PWD` built-in variable instead of calling `$(pwd)` — it's faster since it avoids spawning a subshell.
Reference text is hand-written and may be incomplete — check man pwd for your version. Test destructive commands on a non-production system first.