Linux Command - pwd

pwd - Print full name of current/working directory.

Options

option description
-L, --logical use PWD from environment, even if it contains symlinks
-P, --physical physical. avoid all symlinks.

Description

logical path may contain symlinks. physical path doesn’t have symlinks.

To demonstrate logical and physical path:

1
2
3
4
5
6
cd /tmp
mkdir directory
ln -s directory symlink
cd symlink
pwd -P # prints absolute physical path, /tmp/directory (on MacOS, /private/tmp/directory)
pwd -L # prints absolute logical path, /tmp/symlink

Example

1
pwd
1
pwd -L
1
pwd -P

Reference