pwd - Linux Command

pwd - Linux Command

pwd prints the full name of the current working directory. Consider pwd as the abbreviation of "print working directory".

When you use the command pwd, you get the full system path of the current working directory.
Linux command - pwd

How to use the pwd command:

Example:
To print the current working directory, enter:
 

 $ pwd

Sample outputs:
 

 /home/john

In this example, /home/john is your current working directory.

Note: The full path of any directory under Unix like operating systems always starts with a forward slash (/)

/ – The root directory on your system.
home – A sub-directory.
john – Sub-directory within home sub-directory.

"pwd" use and options:

pwd : prints the present/current working directory.
pwd -L : prints the current working directory logical path, with symbolic link name, if any.
Example: If standing in a dir /home/mysymlink, that is a symlink to /home/myrealdir, this would show /home/mysymlink
pwd -P : prints the current physical directory, without any symbolic links.
Example: If standing in a dir /home/mysymlink, that is a symlink to /home/myrealdir, this would show /home/myrealdir

By default, 'pwd' behaves as if '-L' were specified. In other words, using 'pwd' and 'pwd -L' would produce the same result.

Note: The options -L and -P have CAPITAL L and P.


Further reading about Linux command "pwd":

pwd Wikipedia page
pwd die.net page
pwd Debian manual page
pwd command examples from TechMint

Comments