Pwd command), pwd command

Source: Internet
Author: User

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 ~] #

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.