Understanding the pwd Command

Basic Usage of pwd

The pwd (print working directory) command in Linux is used to display the full path of the current directory you are working in. Here's how to use it:

pwd

This will return the absolute path of your current directory. For example:

/home/user/Documents

Options Available with pwd

The pwd command has two main options that control how it displays the path:

pwd -L (Logical Path)

This option shows the logical path, meaning it displays the path with any symbolic links:

/var/www

Even if /var/www is a symlink to /home/user/public_html, pwd -L will show the path you entered.

pwd -P (Physical Path)

This option resolves and displays the actual physical path by ignoring symbolic links:

/home/user/public_html

Differences Between -L and -P

Option Description
pwd -L Shows the logical path (includes symbolic links).
pwd -P Shows the actual physical path (ignores symbolic links).

Common Use Cases

Manual Pages

For more detailed information, use the man pwd command:

man pwd