pwd

Displays the absolute path of the current working directory.

Supplementary instructions

The pwd (English full spelling: print working directory) command is used to display the user's current working directory (displayed as an absolute path).

Built-in commands

Summary

pwd [-LP]

Options

-L (default) Print the value of the environment variable "$PWD", which may be a symbolic link.
-P Prints the physical location of the current working directory.

return value

The return status is success unless an illegal option is given or the current directory cannot be read.

Notice

External commands

Summary

pwd [OPTION]...

The main purpose

Options

-L, --logical Print the value of the environment variable "$PWD", which may be a symbolic link.
-P, --physical (default) Print the physical location of the current working directory.
--help Display help information and exit.
--version Display version information and exit.

return value

The return status is success unless an illegal option is given or the current directory cannot be read.

Notice

example

View current path

[root@localhost var]#pwd
/var

Display the file path that the soft link file ultimately points to

[root@localhost ~]# cd /var/ # Enter the /var directory. There is a mail soft link file in this directory.
[root@localhost var]# ls -al
total 164
...
lrwxrwxrwx 1 root root 10 Oct 17 2015 mail -> spool/mail

[root@localhost var]# cd mail/ # Enter the mail directory, where mail is the connection file.
[root@localhost mail]# pwd # By default, the connection file is used and the full path of the connection file is directly displayed.
/var/mail

Using the -P parameter, what is displayed is not the logical path, but the file that the connection (soft link) file ultimately points to.

[root@localhost mail]# pwd -P
/var/spool/mail