Using the PWD Command in Linux with Examples

04 May 2023 Balmiki Mandal 0 Linux

What is the PWD Command in Linux?

The pwd command in Linux is a command line tool used to print out the full path of the current working directory. It stands for “print working directory” and it displays the absolute path of the current directory in the shell.

How to Use the PWD Command in Linux

To use the pwd command, simply open a terminal window, type "pwd" and press enter. This will display the full path of the current working directory. This command can also be used with other options to modify how it behaves. For example, by using the -P option, it can be used to display the physical pathname of the current directory, instead of the logical one.

Examples of PWD Command in Linux

Here are some examples of how to use the pwd command in Linux:

  • To display the full path of the current working directory: $ pwd
  • To display the physical pathname of the current directory: $ pwd -P
  • To display the full path of the parent directory: $ pwd ..
  • To display the full path of a specific directory: $ pwd /home/user/mydir

Conclusion

The pwd command is a simple but useful command that allows you to quickly view the full path of the current working directory. With a few additional options, it can be used to display the physical pathname of a directory or the full path of any other directory you specify.

BY: Balmiki Mandal

Related Blogs

Post Comments.

Login to Post a Comment

No comments yet, Be the first to comment.