pwd — Print the current working directory across all 5 shells
Equivalents in every shell
Worked examples
Just print the current directory
Bash
pwdPowerShell
pwdcmd.exe
cdPrint the resolved (symlink-followed) directory
Bash
pwd -PPowerShell
(Get-Item .).FullNameUse in a script variable
Bash
here=$(pwd)PowerShell
$here = (Get-Location).Pathcmd.exe
set here=%cd%Gotchas
- In cmd, `%cd%` is a dynamic variable — it always reflects the current directory, even after `cd`.
- PowerShell `$PWD` is an object with `.Path`, `.Drive`, `.Provider` — concatenation with strings often needs `.Path`.
- Logical vs physical: Unix `pwd` (without `-P`) shows the logical path including symlinks.
WSL & PowerShell Core notes
pwshThe `pwd` alias for `Get-Location` exists on every PowerShell Core platform, but on Linux/macOS the system `/bin/pwd` also resolves and may win depending on call style. Inside scripts, prefer `$PWD.Path` or `(Get-Location).Path` for portability.
WSL`pwd` inside WSL returns the Linux view (e.g. `/mnt/c/Users/me`). To translate it to the Windows form (`C:\Users\me`) run `wslpath -w "$(pwd)"`; for the reverse, `wslpath -u "C:\path"`.