The pwd command has two options, -L and -P, that affect how the current working directory is displayed:
-
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/linkis a symbolic link to/home/user/actual_directory, runningpwd -Lwhile inlinkwill output:/home/user/link -
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, runningpwd -Pwhile inlinkwill output:/home/user/actual_directory
Summary:
- Use
pwd -Lto see the path as it is represented, including symbolic links. - Use
pwd -Pto see the actual physical path without any symbolic links.
If you have more questions or need further clarification, feel free to ask!
