CentOS Debian Mint openSUSE Red Hat Ubuntu

pwd Command in Linux

pwd Command in Linux


pwd stands for print working directory. This command is very useful and is commonly used in Linux. When used the command will print the full path of the root directory to the current directory.

pwd is the command built into the shell or /bin/pwd. You can run the type command to see where pwd is contained:

$ type -a pwd


Below is the guide on how to use the pwd command in Linux as we go through below.

The syntax of pwd command

To find the current directory, run:

$ pwd


You can use another way with PWD environment variable:

$ echo $PWD



pwd -L: Prints the symlink.

pwd -P: Prints the real path.

By default, if you use the command without option, it will specify -L option.

To understand more clearly, we will create a directory and symlink to the directory:

$ sudo mkdir /usr/directory
$ sudo ln -s /usr/directory /usr/symlink

Next, we will navigate to /usr/symlink:

$ cd /usr/symlink

And now, we will try to use pwd command with -L option:

$ pwd -L


If you use pwd command with -P option:

$ pwd -P



You’ve already gone through the details of how to use the pwd command in Linux.

Thanks for reading.

Similar Posts