How does 'pwd -L' differ from 'pwd -P'?

The pwd command has two options, -L and -P, that affect how the current working directory is displayed:

  1. pwd -L (Logical):

    • Displays the logical path of the current working directory.
    • If you are in a directory that is a symbolic link, it shows the path as it appears in the filesystem, including the symbolic link.

    Example:
    If /home/user/link is a symbolic link to /home/user/actual_directory, running pwd -L while in link will output:

    /home/user/link
  2. pwd -P (Physical):

    • Displays the physical path of the current working directory.
    • It resolves all symbolic links and shows the actual directory path on the filesystem.

    Example:
    Using the same scenario, running pwd -P while in link will output:

    /home/user/actual_directory

Summary:

  • Use pwd -L to see the path as it is represented, including symbolic links.
  • Use pwd -P to see the actual physical path without any symbolic links.

If you have more questions or need further clarification, feel free to ask!

0 Comments

no data
Be the first to share your comment!