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)
Preface: The "Getting Started with MySQL&quo...
Table of contents JavaScript prototype chain Obje...
This article shares the specific code for impleme...
This article mainly introduces the example analys...
Grid is a two-dimensional grid layout system. Wit...
Table of contents question extend Solving the pro...
This article shares the installation and configur...
Linux system version: CentOS7.4 MySQL version: 5....
When the created tab label exceeds the visible ar...
This article shares the installation tutorial of ...
Recently, I used vuethink in my project, which in...
Chinese Tutorial https://www.ncnynl.com/category/...
Three ways to set borders in HTML border-width: 1...
Let me show you the effect picture first. Persona...
nginx Overview nginx is a free, open source, high...