Copyright Notice Updated: 2017-05-08
Bo Master: Luckyalan
Contact: [Email protected]
Statement: Draft not forget to dig well man, reproduced please indicate the source!
1 Article Introduction
This article describes the Linux command CD.
2 Development Platform
Linux
3 Pre-reading instructions
No
4 Article body
The PWD (print working Directory) is used to output the absolute path of the current working directory. When we operate on the terminal, we have a current working directory. When unsure of the current location, PWD is used to determine the exact location of the current directory within the file system.
4.1 Commands
Command format: pwd [Options]
Command function: View the absolute path of the current working directory.
4.2 Parameters
Normally without any parameters, if the directory is a link, you can use:
1 pwd-p
Displays the actual path, not the connection path.
4.3, common example 4.3.1 usedpwdTo view the completion path for the default working directory
Command: pwd
Output:
1 [[email protected] ~]# pwd2 /root3 [[email protected] ~]#
4.3.2 Usepwdcommand to view the specified folder
Command: pwd
Output:
1 [[email protected] ~]# cd/opt/soft/23 /opt/soft4 [[email] Protected] soft]#
4.3.3 Directory Connection link
When a directory connection is linked, Pwd-p displays the actual path, not the connection path; pwd shows the connection path
Command: pwd-p
Output:
1 [[email protected] soft]# cd/etc/2[[email protected] init.d]# pwd3 /etc /init.d4 [[email protected] init.d]# pwd-P5 /etc/rc.d/init.d6 [email protected] init.d]#
4.3.4/bin/pwd
Command: /bin/pwd [Options]
Options:
1 -L directory connection link, output connection path 2 -P Output physical path
Output:
1 [[email protected] init.d]#/bin/2 /etc/rc.d/init.d3 [[Email protected ] init.d]#/bin/pwd--help4 [[email protected] init.d]#/bin/pwd-P5 /etc/rc.d/ INIT.D6 [[email protected] init.d]#/bin/pwd-L7 /etc/init.d8 [email protected] init.d]#
4.3.5 The current directory is deleted, and the PWD command still loves that directory.
Output:
1 [[email protected] init.d]#/bin/2 /etc/rc.d/init.d3 [[Email protected ] init.d]#/bin/pwd--help4 [[email protected] init.d]#/bin/pwd-P5 /etc/rc.d/ INIT.D6 [[email protected] init.d]#/bin/pwd-L7 /etc/init.d8 [email protected] init.d]#
4.4 Description
In 4.3, it is not clear what is "directory connection link", because in addition to 4.3.1, 4.3.2 outside, have not met, so temporarily do not delve into, encountered later do study.
5 References
1, the concept of this part of the reference to Wikipedia.
2, this article is to a large extent from the "one Linux command per day (3): pwd command."
One Linux command per day (4): pwd command