pwd command in Linux with Examples

pwd command is the print working directory. It is one of the most frequently used Linux. like is cd or ls command.

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.

pwd command in Linux with Examples

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!

About HuuPV

My name is Huu. I love technology, especially Devops Skill such as Docker, vagrant, git, and so forth. I like open-sources, so I created DevopsRoles.com to share the knowledge I have acquired. My Job: IT system administrator. Hobbies: summoners war game, gossip.
View all posts by HuuPV →

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.