How to know working directory using pwd command in Linux?

As a beginner, we open the terminal and start using the commands in any Linux distribution. But, have it ever occured to your mind that where are you performing all your tasks i.e., if you have created a file, then where it is created, in which directory it is created? If you used ls command and you see the list of files and directories then these files and directories belong to which directory?
pwd is the answer to all these questions. Here, in this article, we will discuss how to use pwd command in Linux?


The use of pwd command is to know the present working directory i.e., in which directory is the user performing his/her activities.


      pwd [OPTION]...


use of pwd command in linux

using pwd displays the current working directory which in this case is /home/baljit. It can be used at any time to know the exact location of the activities being performed. As a beginner, after using a command like cd (change directory), one might get lost and be unsure about the directory in which he/she is currently working. pwd comes in handy under these circumstances.

It is a very important command as it will tell the user the exact path starting from the root directory to the current working directory. pwd is shell specific, so the exact behaviour of options available might differ from shell to shell. The most common options are:

Options used with pwd command in Linux

  1. -P: which avoids symbolic links
  2. -L: uses PWD from the environment even when symbolic links are available

Sample Questions using pwd command in Linux

Q1. How can you know the path of the directory in which you are working?
Q2. How can you know the name of the directory in which you are working?

Other Related Commands


Leave a Reply

Your email address will not be published. Required fields are marked *