"Linux" Environment variable settings

Source: Internet
Author: User

Setting environment variables in Windows is a very easy thing to do. For example with. Just right click on the environment variable of the advanced system settings----My Computer, select Path, then tap "Edit" to enter the content you want to join.

The ability to add some command-line commands that you want to execute directly.

Java, for example, is going to get the bin folder under the JDK and so on.


However. It's not that simple in Linux.

Take Ubuntu for example. Environment variables are set up in two ways, one of which is

Open the terminal via Ctrl+alt+t and enter:

sudo gedit/etc/environment
After entering password, open the configuration file for the system variable. Then change the content inside.


System environment variables. Join directly at the end

: The path you want to set.

Use the colon: Cut directory.

After saving exit, pass in terminal.

Source/etc/environment
Make it effective.

This command has the same ability to restore errors such as sudo and other intrinsic commands. When you enter sudo, the "xx is not in the PATH environment variable, so cannot find the command" prompt, assuming that your/ext/environment has not been changed, can be repaired by the command.

It is only generally not advisable to do so. Assuming that the change is wrong, the entire Ubuntu intrinsic command sudo will not work.

The user environment variable is usually set in the terminal via:

Gedit ~/.BASHRC
Open the User environment variable configuration file, which can be opened without the sudo command, because it is a user environment variable,

Turn to the end, and fill in a sentence:

Export path=xx: $PATH, where xx is the path you set. The following: $PATH is indispensable.

Without formatting, the same can cause intrinsic commands such as sudo,apt-get to not run.

For example, the android ADB command is configured in the user's environment variable.

After. Save exit. In Terminal input:

SOURCE ~/.BASHRC
is in effect.


"Linux" Environment variable settings

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.