Home·Terminal commands

pwd

Files and directories

Usage

pwd [-P]

Prints the directory you are standing in; if you walked in through a symlink it shows the link path, and only -P gives the real one.

Common flags

FlagMeaning
-LPrint the logical path from $PWD, symlinks kept (default)
-PPrint the physical path with every symlink resolved

Examples

pwd

Which directory am I standing in.

pwd -P

The real path when you walked in through a symlink.

Moving, deleting and finding. Some of these do not ask twice, which is why -i becomes a habit.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does pwd do?

Prints the directory you are standing in; if you walked in through a symlink it shows the link path, and only -P gives the real one.

Q. How do I type it?

pwd [-P] — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

2 are listed here; the full set is in man pwd. This command sits under Files and directories.

Related commands

man page: man pwd