Path Problems in Linux

Source: Internet
Author: User

Note: In general, if we use shell to call your application, or how do you call your application?ProgramNote that the path at the moment is the path of your called program.

Paths are classified into absolute paths and relative paths:

Absolute path:

In Linux, the absolute path starts with/(also known as the root directory), such as/USR and/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;

Relative path;

The relative path is. or .. start ,. 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 enter.
[Root @ localhost ~] # PWD Note: determine the location of the current user;
/Root note: obtained in the/root directory;
[Root @ localhost ~] # CD .. Note: We cut in 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;

 

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 current user's home directory
~ User indicates the home directory where the user name is user. Here, the user name exists in/etc/passwd;

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.