Skip to content
shellmap

pwdPrint the current working directory across all 5 shells

Equivalents in every shell

Bashunix
pwd
Zshunix
pwd
Fishunix
pwd
PowerShellwindows
Get-Location

Aliased as `pwd` and `gl`. Shorter: `$PWD`.

cmd.exewindows
cd

Calling `cd` with no arguments prints the current directory.

Worked examples

Just print the current directory

Bash
pwd
PowerShell
pwd
cmd.exe
cd

Print the resolved (symlink-followed) directory

Bash
pwd -P
PowerShell
(Get-Item .).FullName

Use in a script variable

Bash
here=$(pwd)
PowerShell
$here = (Get-Location).Path
cmd.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"`.

Related commands