pwd Command. Check current working Directory.

pwd command

pwd command is a very simple but it is very helpful and frequently used while playing with Linux file system. When you logged in to your system like a file Linux or Unix system places you in a specific directory.

Wha is pwd command ?

pwd also known as print working directory helps you to know what your current directory is. But by default in Linux system, when you log in, your current working directory is set to your home directory as i have discussed in file system. pwd command helps to return the current working directory name.

The pwd utility gives the absolute pathname of the current working directory to the standard output.

It is a shell builtin command in most of the known shells like zsh, bash, ksh etc.

What is current working directory ?

As you know you move from directory to directory in your system, but at a point of time you are located in a particular directory. We know it as current working directory or current directory.

Note: We often use cd command to switch between our directories.

Synopsis / Syntax

The general syntax for pwd command is

pwd [options]

Now let use invoke the general command and see the output.

$ pwd
Output

/home/tcd

Options

There are two options in this command.

OptionOutput
-L, –logical
use PWD from environment,even if it contains symlinks
-P, –physicalavoid all symlinks

Remember: If you don’t use any option -P is assumed.

You can check different version of pwd by using the below command.

$ pwd --version

Conclusion

From the article you have got a very basic and good idea that how to use pwd command. Its a very helpful command in our day to day use of Linux or Unix system. If you have any queries related to this topic please feel free to leave a comment. Stay tuned for more articles.

2 Comments on “pwd Command. Check current working Directory.”

Leave a Reply

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