Add a new path permanently in linux

Source: Internet
Author: User

To install software in linux, you must add the Software Directory to the system PATH variable. To use the software, you only need to enter the software name, without the complete path of the software. Suppose we have installed a new apache-ant tool. Its path is/opt/ant. the software installation documentation often only tells you how to add a new PATH temporarily, that is, "export PATH = $ PATH: newProg". You need to add a new PATH for the next login. Therefore, knowing how to add a new PATH to the PATH variable permanently is a basic skill for linux players. Because linux is a multi-user operating system, it also supports multiple users in terms of paths. Therefore, adding paths can be divided into user-effective and system-effective ones. add the PATH variable to a specific user. The user's home directory contains a hidden file called. open bash_profile and add a PATH = $ PATH:/opt/ant/bin to save and close the file. The newly added PATH takes effect after the user logs on to the file. In the end, this file is like this #. bash_profile # Get the aliases and functionsif [-f ~ /. Bashrc]; then .~ /. Bashrcfi # User specific environment and startup programs PATH = $ PATH:/opt/ant/bin export PATH2. add an ant to the PATH variable of the system/(all users. sh text file to/etc/profile. d/directory, open it and type export PATH = $ PATH:/opt/ant/bin to save and exit. The next login will take effect.
 

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.