In this article we are going to shows how to use pwd command in Linux Terminal. If you want to learn about pwd command in Linux with Examples then this post is ideal for you.
In the linux operating systems, the pwd is a command utility that is used to print the full pathname of the current working directory to the standard output. It is stands for Print Working Directory.
A directory where you are currently working in is know as Current Working Directory. In the Linux, when you log in to your system then your current working directory is home directory. You can easily change the directory using cd command:
$ cd /tmpThe above command change the your current working directory to /tmp directory.
pwd Command Linux
The pwd command is one of the most frequently used commands in Linux. When you run this command, it is prints the path of the current working directory.
pwd command is a shell built-in in most latest and modern shells such as bash and zsh. Its behavior is slightly different than the standalone /bin/pwd executable. Use the type command to show all locations containing pwd:
$ type -a pwdOutput
pwd is a shell builtin
pwd is /bin/pwdFind your Current Working Directory using pwd
To find your currently working directory, run the pwd command in your terminal as below:
$ pwdOutput
/home/studiesonlineThe above command print the full pathname of the your current working directory to the standard output as show in above output.
You can also get your current working directory, by printing environment variable as below:
$ echo $PWDOutput
/home/studiesonlineThere are only two arguments that you can pass along with pwd command:
-L(--logical) – Prints the symbolic path.-P(--physical) -Prints the actual path
By default, When you use pwd command without any arguments then it will behave as -L option.
To understand the -P option that how it is work, create a directory and symlink pointing to the directory:
mkdir /var/directory
ln -s /var/directory /var/symlinkNow change your directory to the /var/symlink directory and run the pwd command in your terminal:
$ pwdThe above command display that your current working directory is /var/symlink:
Output
/var/symlinkAnd now run the pwd command with the -P option:
$ pwd -PThe above command will display the actual directory to which the symlink points to:
Output
/var/directoryThat’s all
If you face any error and issue in above steps , please use comment box below to report.
If our tutorials helped you, please consider buying us a coffee. We appreciate your support!
Thank you for your support.



