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;