Forrest logo
back to the pwd tool

pwd:tldr:84491

pwd: Print the current directory, and resolve all symlinks (i.e. show the "physical" path).
$ pwd -P
try on your machine

The pwd command stands for "print working directory" and is typically used to display the current working directory in a command-line interface.

The -P option, when used with pwd, instructs the command to display the physical directory path, rather than the symbolic path. This means that if there are any symbolic links (or shortcuts) in the directory path, it will resolve them and return the actual physical path to the current directory.

For example, if there is a symbolic link called "link" that points to "/home/user/myfolder" and you are currently in that directory, using pwd -P will display "/home/user/myfolder" instead of "/home/user/link".

In summary, pwd -P helps you get the physical path of the current working directory, taking into consideration any symbolic links in the directory path.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the pwd tool