How to set ubuntu environment variables

Source: Internet
Author: User
There are three ways to set environment variables in Ubuntu: one for the current terminal, the other for the current user, and the other for all users. Next let's take a look at the specific settings. Ubuntu

I. used on the current terminal:

Enter:

Copy codeThe code is as follows:
Export PATH = $ PATH: <Path you want to add>

However, the above method only applies to the current terminal. once the current terminal is closed or in another terminal, it is invalid.

II. used for the current user:

There is a. bashrc hidden file in the user's main directory. you can add the PATH settings in this file as follows:

Copy codeThe code is as follows:
Vi ~ /. Bashrc

Join:

Copy codeThe code is as follows:
Export PATH = <Path you want to add> : $ PATH

If you want to add multiple paths, as long:

Copy codeThe code is as follows:
Export PATH = <Path 1 you want to add> : <Path 2 you want to add> : ......: $ PATH

Each path must be separated by a colon.

In this way, each login will take effect.

3. for all users:

Copy codeThe code is as follows:
Sudo vi/etc/profile

Join:

Copy codeThe code is as follows:
Export PATH = <Path you want to add> : $ PATH

You can.

Related Article

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.