For example, if your current path is /var/log, and now you want to enter the /usr directory, you can execute the following command:
cd ../../usr #通过相对路径先退到/var目录下,再退到/下,最后进如/usr下
(Recommended tutorial:linux tutorial)
The equivalent path is relative to the current directory.
../ #表示上级目录 ./ #表示当前目录下 ./XXX #表示当前目录下的XXX文件或者XXX目录
Using relative paths does not necessarily require returning to the directory.
If the current path is /var/log, you want to go to /var/run/
cd ../run #先退到/var目录,然后进入/var目录下的run目录
Recommended related video tutorials:linux video tutorial
The above is the detailed content of How to express relative path in linux. For more information, please follow other related articles on the PHP Chinese website!