Pwd command (convert), pwd command
Original article: http://www.cnblogs.com/peida/archive/2012/10/24/2737730.html
In Linux, run the pwd command to view the complete path of the "current working directory. To put it simply, whenever you operate on a terminal, you will have a current working directory.
If you are not sure about the current location, pwd is used to determine the exact location of the current directory in the file system.
1. Command Format:
Pwd [Option]
2. command functions:
View the complete path of the "current working directory"
3. Common parameters:
Generally, no parameters are included.
If the directory is linked:
Format: pwd-P shows the actual path instead of the link path.
4. Common instances:
Instance 1: run the pwd command to view the full path of the default working directory.
Command:
Pwd
Output:
[Root @ localhost ~] # Pwd
/Root
[Root @ localhost ~] #
Instance 2: Use the pwd command to view the specified folder
Command:
Pwd
Output:
[Root @ localhost ~] # Cd/opt/soft/
[Root @ localhost soft] # pwd
/Opt/soft
[Root @ localhost soft] #
Example 3: pwd-P shows the actual path instead of the link path when connecting to the directory. pwd shows the connection path.
Command:
Pwd-P
Output:
[Root @ localhost soft] # cd/etc/init. d
[Root @ localhost init. d] # pwd
/Etc/init. d
[Root @ localhost init. d] # pwd-P
/Etc/rc. d/init. d
[Root @ localhost init. d] #
Instance 4:/bin/pwd
Command:
/Bin/pwd [Option]
Option:
-L directory connection path output
-P physical output path
Output:
[Root @ localhost init. d] #/bin/pwd
/Etc/rc. d/init. d
[Root @ localhost init. d] #/bin/pwd -- help
[Root @ localhost init. d] #/bin/pwd-P
/Etc/rc. d/init. d
[Root @ localhost init. d] #/bin/pwd-L
/Etc/init. d
[Root @ localhost init. d] #
Instance 5: the current directory is deleted, and the pwd command still displays the Directory
Output:
[Root @ localhost init. d] # cd/opt/soft
[Root @ localhost soft] # mkdir removed
[Root @ localhost soft] # cd removed/
[Root @ localhost removed] # pwd
/Opt/soft/removed
[Root @ localhost removed] # rm ../removed-rf
[Root @ localhost removed] # pwd
/Opt/soft/removed
[Root @ localhost removed] #/bin/pwd
/Bin/pwd: couldn't find directory entry in ".." with matching I-node
[Root @ localhost removed] # cd
[Root @ localhost ~] # Pwd
/Root
[Root @ localhost ~] #