In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use CDPATH to define the basic directory for the linux cd command". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to use CDPATH to define the basic directory for the linux cd command.
If you often use the linux cd command to enter a subdirectory under a specific parent directory, you can set the parent directory to CDPATH. You do not need to specify the parent directory path when you execute the linux cd command to enter the subdirectory. The explanation is as follows:
[ljf@localhost ~] $pwd
/ home/ljf
[ljf@localhost ~] $cd mail
-bash: cd: mail: No such file or directory
[linux cd command note: here is to find the mail directory under the current directory]
[ljf@localhost ~] $export CDPATH=/etc
[ljf@localhost ~] $cd mail
/ etc/mail
[linux cd command note: look for the mail directory under the / etc directory, not the current directory]
[ljf@localhost mail] $pwd
/ etc/mail
[ljf@localhost mail] $
To change the base directory, add a line of code export CDPATH=/etc to your ~ / .bash_profile file.
Similar to the PATH variable, you can add multiple directory entries to the CDPATH variable, separated by ":", such as:
Export CDPATH=.:~:/etc:/var
This technique is very helpful in the following environments:
Oracle database administrators often work in the $ORACLE_HOME directory and can set the CDPATH variable to the Oracle root directory.
Unix system administrators often work in the / etc directory, and you can set the CDPATH variable to / etc.
Developers often work in the / home/projects directory, so you can set the CDPATH variable to / etc.
End users often visit their home directory and can set the CDPATH variable to ~ (home directory).
In this way, you no longer need to specify the parent directory path when you execute the linux cd command to enter the subdirectory.
Thank you for your reading, the above is the content of "how to use CDPATH to define the basic directory for the linux cd command". After the study of this article, I believe you have a deeper understanding of how to use CDPATH to define the basic directory for the linux cd command. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.