Relative and absolute paths of Linux Learning

Source: Internet
Author: User

Relative and absolute paths of Linux Learning
1. absolute path

In Linux, the absolute path starts from/(also known as the root directory), for example,/usr,/etc/x11. if a path starts from, it must be an absolute path.

[Root @ localhost ~] # PWD Note: determine the user's current location, that is, where is the user's location?

/Root note: the user is currently located at/root.

[Root @ localhost ~] # Cd/usr/share/doc/Note: we enter the/usr/share/doc directory in an absolute path.

[Root @ localhost Doc] # PWD Note: determine the current user location.

/Usr/share/DOC note: the user is located in/usr/share/doc, which seems to have achieved our goal.

2. Relative Path
The relative path is... or ...... ,. Indicates the location of the user's current operation, and ...... Indicates the parent directory; In the path ,. Indicates the current directory of the user, and ...... Upper-level directory. And ...... As a directory.

[Root @ localhost ~] # PWD Note: Pwd is used to determine the location of the current user.

/Root note: the directory is in the/root directory.

[Root @ localhost ~] # Cd. Note: We will enter.

[Root @ localhost ~] # PWD Note: determine the location of the current user.

/Root note: It is obtained in the/root directory.

[Root @ localhost ~] # Cd ...... Note: we will switch to the/root parent directory.

[Root @ localhost/] # PWD Note: determine the location of the current user.

/Note: the user is currently in the/(root directory.
3. Descriptions of some special symbols in the path

These symbols are applied in relative paths, which can be convenient for us, so it is necessary to talk about them.

. Indicates the current directory of the user;

...... Indicates the parent directory;

~ Indicates the Home Directory of the current user;

~ User indicates the home directory where the user name is user. Here, the user name exists in/etc/passwd.

Quasi-path and physical path
Here is an example of IIS:
The Web service directory is D:/test.
When you access the root directory of the website through HTTP, you actually access D:/test. Then, the virtual path is/(Root), and the physical path is D:/test.

Generally, virtual paths and physical paths are commonly used in Web and FTP services.

Relative paths and absolute paths are widely used.
Relative Path: for example, D:/test1/Test2/test3
Test2 is the lower-level path of test1, and Test2 is the higher-level path of test3. Therefore, both the higher-level path and the lower-level path are relative. Generally, the upper-level path can be represented by..., and the current path can be represented.
Absolute path: for example, the C:/root path is absolute, and any path has an absolute nearest path relative to the root path, which is also an absolute path.

If you think about how others are leading the way, you can find out what is relative and what is absolute.
Relative method: move forward from "here" and turn right
Absolute Guidance Method: Yiwei network server maintenance company is 100 to the East (if Yiwei network server maintenance company is an absolute position), the absolute guidance method does not depend on where the guidance person is.
 

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.