For example, if your current path is /var/log and you want to go to the /usr directory, you can execute the following command:
The paths are relative to the current directory.
Using relative paths does not necessarily require backing into a directory. If the current path is /var/log, you want to go to /var/run/
Knowledge point expansion: Uses of relative paths So what's the big deal about relative paths and absolute paths? drink! That's really amazing! Suppose you have written a software that requires three directories, namely etc, bin, and man. However, different people like to install the software in different directories. Suppose Person A installs the software in /usr/local/packages/etc, /usr/local/packages/bin, and /usr/local/packages/man, but Person B likes to install the software in /home/packages/etc, /home/packages/bin, and /home/packages/man. If absolute paths are required, will it be troublesome? Yes! In this way, it is difficult to match the contents in each directory! At this time, the writing of relative paths is particularly important! In addition, if you are like me, and like to write long path names so that you know what the directory is for, for example: the directory /cluster/raid/output/taiwan2006/smoke, and another directory is /cluster/raid/output/taiwan2006/cctm, then if I want to go from the first to the second directory, how should I write it more conveniently? Of course cd.../cctm is more convenient! Right! Purpose of absolute path However, regarding the correctness of the file name, "the accuracy of the absolute path is better~". Generally speaking, I would recommend that you use absolute paths when writing shell scripts to manage your system. How to say it? Although it is more troublesome to write an absolute path, it is certain that there will be no problem with this writing method. If you use relative paths in your program, some problems may occur due to the different working environments you are running in. This is the end of this article about how to represent relative paths in Linux. For more information about how to represent relative paths in Linux, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! |
<<: js realizes the effect of Tanabata confession barrage, jQuery realizes barrage technology
>>: MySQL 8.0.18 installation and configuration method graphic tutorial (linux)
By applying it, some public areas of the website c...
Analyze the execution process. Move the mouse int...
Table of contents 1. Block scope 1.1. let replace...
1. Install openssh-server yum install -y openssl ...
Table of contents What is MySQL NDB Cluster Preli...
What is Nginx access restriction configuration Ng...
Prerequisites: Docker is already installed 1. Fin...
1. SHOW PROCESSLIST command SHOW PROCESSLIST show...
1. Download the download link Click download. You...
This article uses an example to illustrate the pa...
Written in front Recently, a reader told me that ...
introduction: Nowadays, many dynamic verification...
Preface My needs are syntax highlighting, functio...
MySQL supports hash and btree indexes. InnoDB and...
Preface This article introduces how to use the ne...