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

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

  • pwd -L: Prints the current working directory, following symbolic links. It shows the path as it appears in the shell, including any symlinks.

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

Example:

If you are in a directory that is a symlink:

  • pwd -L might output /home/user/symlink_dir
  • pwd -P might output /home/user/actual_dir

This distinction is useful for understanding whether you're viewing the symlink path or the real path. Let me know if you need more information!

0 Comments

no data
Be the first to share your comment!