Linux Common Commands 3:pwd

Source: Internet
Author: User

about PWD Commands

In Linux, use the PWD command to view the full path to the current working directory. Simply put, 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.

command Format

PWD [Options]

Command Function

View the full path to the current working directory

Common Parameters

Normally without any parameters

If the directory is a link:

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

Common examples

Example 1: Viewing the full path of the default working directory with the PWD command

Output:

[Email protected] ~]# pwd

/root

[Email protected] ~]#

Example 2: Viewing a specified folder using the PWD command

Command: PWD

Output:

[Email protected] ~]# cd/opt/soft/

[Email protected] soft]# pwd

/opt/soft

[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:

[Email protected] soft]# CD/ETC/INIT.D

[Email protected] init.d]# pwd

/etc/init.d

[Email protected] init.d]# pwd-p

/etc/rc.d/init.d

[Email protected] init.d]#

Example 5:/bin/pwd

Command:/bin/pwd [options]

Options:

-L directory connection link, output connection path

-P Output Physical path

Output:

[Email protected] init.d]#/bin/pwd

/etc/rc.d/init.d

[Email protected] init.d]#/bin/pwd--help

[Email protected] init.d]#/bin/pwd-p

/etc/rc.d/init.d

[Email protected] init.d]#/bin/pwd-l

/etc/init.d

[Email protected] init.d]#

Example 5: The current directory is deleted, and the PWD command still displays that directory

Output:

[Email protected] init.d]# Cd/opt/soft

[Email protected] soft]# mkdir removed

[Email protected] soft]# CD removed/

[Email protected] removed]# pwd

/opt/soft/removed

[Email protected] removed]# RM. /removed-rf

[Email protected] removed]# pwd

/opt/soft/removed

[Email protected] removed]#/bin/pwd

/bin/pwd:couldn ' t find directory entry in ":" with matching I-node

[[Email protected] removed]# CD

[Email protected] ~]# pwd

/root

[Email protected] ~]#

Linux Common Commands 3:pwd

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.