The PWD command is very helpful for Linux users who work with the command line, it helps to find out the current location from the root directory. This command is very useful, especially for people who are learning Linux or are not comfortable with Linux Command.
What is PWD?
In Linux and other Linux distributions, the PWD command is used to print the current working directory and structure of the Linux file and directory . The full form of the PWD is the Present Working Directory which displays the path from the root to the present location. PWD is an environment variable that stores the path of present working directory.
pwd Syntax
If you want to run the PWD command in the Linux terminal, then you can use the syntax given below.
pwd [-options]
Options used with PWD
| Options | Description |
| -L, –logical | Use PWD from the environment, even if it contains symbolic links |
| -P, –physical | Avoid all symbolic links |
| –help | Display this help and exit |
| –version | Output version information and exit |
in Linux operating system There are many options available for the PWD command , which you will know through this article.
If you use both the ‘-L’ and ‘-P‘ options with the PWD command, Linux gives the first priority to the ‘L’ Option. If no option is given with the PWD command, Linux skips all symbolic Link, i.e. the option ‘-P’ will print as a result.
- Check Current Working Directory : if you want to print the current working directory in the Linux terminal run the below command .
[root@simitech-linux SOFTWARE1]# pwd


Print symbolic links
To understand symbolic links with the PWD command, print the symbolic link for any link directory which was present in the system. For example, we created a symbolic link from /var/wwwhHtml/ to the /root/home directory and then ran the PWD command to print the symbolic link and no symbolic link.
To understand the PWD symbolic link, first, create a symbolic link to the folder /var/www/html as a test in your home directory and go Under that directory.

- Using the -L Option You can use the -L option with the PWD command and the system prints the current working directory with the symbolic link. In below example you can check the symbolic link along with the current working directory.

- Using the -P Option -Using the -P option with the PWD command allows to print the physical working directory and prevents symbolic links from being printed. use this option to print the absolute path to the working directory.

- Check pwd Version : If you want to check the version of the PWD command, then you can to execute the/bin/PWD –version command in the terminal.
#/bin/pwd --version

- Check Previous Working Directory : If you want to know the status of the previous working directory, then you can use the $OLDPWD variable. The $OLDPWD variable stores the History of the previous working
#echo "$OLDPWD" directory

- Use Help Command : If you want to know about more options related to pwd command, then for this you should use help command .
Conclusion
The PWD command is the most useful and simple command in Linux, which is used to find the present working directory. Comment for any kind of feedback related to this article and subscribe to our simitech blog for coming technical articles. For similar information visit our other website simiservice.com
- Top 20 Highest Salary Jobs : Lucrative Careers with Best Salaries - 5 April 2025
- Types of Operating System (OS): Features,Types And Uses - 5 April 2025
- 15 Features of Operating System You Should Know - 4 April 2025



