Instructions for using the Linux pwd command

Source: Internet
Author: User
Tags mkdir

In a Linux hierarchy, users can create a new directory using the mkdir command in any given directory, or you can use the CD command to convert from one directory to another. However, there is no prompt to tell the user which directory is currently in. To know the current directory, you can use the PWD command, which displays the entire path name.

Name
Print Working Directory
Use
Displays the path name of the working directory.
Grammar
PWD [-l |-p]
Describe
The PWD command writes the full path name (from the root directory) of the current directory to standard output. All directories are separated by/(slash). The first/represents the root directory, and the last directory is the current directory.

Sign

-l– Display Logical Path
-p– Show Physical Path

Example:

The code is as follows Copy Code

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

To view a specified folder using the PWD command

Command:

Pwd

Output:

The code is as follows Copy Code

[Root@localhost ~]# cd/opt/soft/
[Root@localhost soft]# pwd
/opt/soft
[Root@localhost soft]#

The current directory is deleted and the PWD command still displays that directory

Output:

  code is as follows copy code
[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 ~]#

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.