23 January 2022

pwd is a command to show the current working directory.
There is also an environment variable ${PWD} that could be used to print the current working directory.

Note: all example below could be execute in a container:

docker run -it  ubuntu /bin/bash

Example:

pwd
/

or

echo ${PWD}
/

In case of symbolic link could be used to retrieve the physical directory:

  1. Create a symbolic link
    ln -s /etc/init.d/ /init.d
    
  2. Go inside the symbolic link
    cd /init.d
    
  3. If execute command without parameter show the current directory
    pwd
    /init.d
    
  4. If execute command with -P parameter show the physical directory
    pwd -P
    /etc/init.d
    

References