The pwd
command in Linux is used to print the current working directory. It displays the absolute path of the current directory where you are located within the file system.
The syntax pwd command
pwd [Option] ...
On the man page, the describes it
Print the full filename of the current working directory.
pwd command in Linux with Examples
The full PathName of the current working directory.
[huupv@DevopsRoles ~]$ cd /etc/nginx
[huupv@DevopsRoles nginx]$ pwd
/etc/nginx
Use the -P
option to display the physical path:
pwd -P
Use the -L
option to display the logical path:
pwd -L
Print the current directory with a symbolic link indicator:
pwd -P -L
By combining both the -P
and -L
options, the pwd
the command will display the physical path and indicate any symbolic links present in the path.
Conclusion
These are some examples of using the pwd
command in Linux. The command is useful for verifying your current directory or capturing it for use in shell scripts or other commands. pwd command is a simple command in Linux. It is the most popular in-use terminal Linux. Thank you for reading the DevopsRoles page!