What is the difference between `pwd` and `pwd -P`?

The difference between pwd and pwd -P lies in how they handle symbolic links:

  • pwd: Prints the current working directory as it appears, which may include symbolic links. If you are in a directory that is a symbolic link, it will show the path of the link.

  • pwd -P: Prints the physical path of the current working directory, resolving any symbolic links. It shows the actual directory structure without following the links.

In summary:

  • pwd: Logical path (may include symbolic links).
  • pwd -P: Physical path (resolves symbolic links).

If you have any further questions, feel free to ask!

0 Comments

no data
Be the first to share your comment!