pwd - Linux


The pwd (Print Working Directory) command in Linux is a simple utility that displays the current working directory path of the user’s shell. It is a crucial tool for users navigating through the filesystem, ensuring that they are aware of their current location within the directory structure. This command is especially useful in scripting, logging, and when working with complex directory hierarchies.


The basic syntax of the pwd command is:


There are no arguments required for executing pwd, as it does not operate on any files but rather displays the directory.


  • -L, --logical: Display the logical current working directory (with symlinks).
  • -P, --physical: Display the physical current directory (with symlinks resolved to their actual physical locations).

By default, pwd behaves as if the -L option is specified.


  1. Display the current working directory:


    This command will output the current location, such as /home/username.

  2. Using the physical option to resolve symlinks:

    pwd -P

    If you are in a directory that is a symlink, this command will show the physical path rather than the symlink path.

Common Issues

  • Symbolic Links Misrepresentation: When in a directory that is a symlink, pwd without the -P flag might give a path that does not represent the physical location. This can be resolved using pwd -P.

  • Permission Denied: Users may encounter a “Permission Denied” error if they do not have the appropriate permissions to one of the parent directories of their current directory.


pwd is commonly used in scripts and command chains to ensure that file operations happen in correct directories. For example:

cd $(pwd)/../other_directory

This command sequence moves up one directory level from the current directory, and then into another directory.

  • cd: Changes the directory.
  • ls: Lists directory contents, useful for inspecting the current directory.

You can learn more about file system commands from the GNU Core Utilities official documentation.

By fluently integrating these basic but powerful commands, users can effectively manage and navigate their filesystem environments in Linux.