The next heavyweight configuration command in Linux: configuration of global variables in cdpath (original)

Source: Internet
Author: User

Next heavyweight configuration command in Linux: configuration of global variables in cdpath
Author: Yu Chao Email: yuchao86@gmail.com

The following is a translation based on the book linix 101 hacks,
I hope you will give me more comments. If you have a better way, please post your comments or send me an email,

If you often use the CD command to a sub-directory or a special parent directory, you can set the global variable cdpath
Specify the sub-directory or special parent directory to which the path is to be sent, without providing an absolute path name.
Example:
Yuchao @ yuchao-Latitude-E5410 :~ $ Pwd
/Home/yuchao
Yuchao @ yuchao-Latitude-E5410 :~ $ CD mail
-Bash: CD: Mail: no such file or directory
[Note: this is looking for mail directory under current
Directory]
Yuchao @ yuchao-Latitude-E5410 :~ $ Export cdpath = .:~ :/Etc:/var:/usr/local
Yuchao @ yuchao-Latitude-E5410 :~ $ CD mail
/Var/mail
@ Yuchao-Latitude-E5410:/var/mail $ pwd
/Var/mail
Yuchao @ yuchao-Latitude-E5410:/var/mail $
[Note: this is looking for mail under/Var and not
Under current directory]
@ Yuchao-Latitude-E5410:/var/mail $ pwd
/Var/mail

to enable the configuration to take effect upon startup, run the configuration command export cdpath = .:~ :/Etc:/var:/usr/local add to your configuration file
~ /. Bash_profile or ~ /. Bashrc, or the global/etc/profile configuration file.
this command is useful for engineers who have set the home working directory, such as your $ java_home, $ tomcat_home, $ ORACLE_HOME, and $ path,
you can add them to this global variable, and then you can directly CD them to the directory you want to go to. It's hack !!
Linux 101 hacks
www.thegeekstuff.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.