Skip to content

pwd

6 commands

Prints the full path of the current working directory, optionally resolving symbolic links.

  • navigation

Install pwd

sudo apt install coreutils

Basics6

pwd

Prints the absolute path of the current working directory.

pwd -P

Prints the physical path with all symbolic links resolved.

pwd -L

Prints the logical path, keeping symbolic links as you navigated them (the default).

echo "$PWD"

The same information from the PWD environment variable, useful in scripts.

echo "$OLDPWD"

Shows the previous directory, which `cd -` returns to.

readlink -f .

Another way to print the fully resolved path of the current directory.