One Linux command per day (3): pwd command

Source: Internet
Author: User

Transferred from: http://www.cnblogs.com/peida/archive/2012/10/24/2737730.html

In Linux, use the PWD command to view the full path to the current working directory. To put it simply, you will have a current working directory every time you operate in a terminal.

When unsure of the current location, PWD is used to determine the exact location of the current directory within the file system.

1. Command format:

PWD []

2. Command function:

View the full path to the current working directory.

3. Common parameters:

In general, no parameters are taken.

If the directory is a link:

Format: Pwd-p shows the actual path, not the link path.

4. Common examples: Instance 1: View the full path of the default working directory with the PWD command

Command: PWD

Output:

1 pwd 2 /root3 [[email protected] ~]#
Example 2: Use the PWD command to view the specified folder

Command: PWD

Output:

1 [[email protected] ~]# cd/opt/soft/2pwd3 /opt/soft4 [[email] Protected] soft]#
Example 3: 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/2pwd3 /etc/init.d4  pwd -P5 /etc/rc.d/init.d6 [[email protected] init.d]#
Example 4:/bin/pwd

Command:/bin/pwd [options]

Option:-L directory connection link, output connection path

-P Output Physical path

Output:

1 [[email protected] init.d]#/bin/pwd2 /etc/rc.d/init.d3 [[email] Protected] init.d]#/bin/pwd --help4 [[email protected] init.d]#/bin/pwd -P  5 /etc/rc.d/init.d6 [[email protected] init.d]#/bin/pwd -L  7 /etc/init.d8 [[email protected] init.d]#
Example 5: The current directory is deleted, and the PWD command still displays that directory

Output:

1[Email protected] init.d]# cd/opt/Soft2[Email protected] soft]#mkdirremoved3[Email protected] soft]# CD removed/4[Email protected] removed]#pwd5/opt/soft/removed6[Email protected] removed]#RM.. /removed-RF7[Email protected] removed]#pwd8/opt/soft/removed9[Email protected] removed]#/bin/pwdTen/bin/pwd: couldn't Find directory entry in ":" with matching I-node One [[Email protected] removed]# CD A[Email protected] ~]#pwd -/Root -[Email protected] ~]#

One Linux command per day (3): pwd command

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.