How to add environment variables in ubuntu

Source: Internet
Author: User
This article mainly introduces how to add environment variables to ubuntu. For more information, see the following tag: Ubuntu.

1./etc/profile: the first file used by the operating system to customize the user environment during login. this file sets environment information for each user in the system. when the user logs on for the first time, the file is executed.

2./etc/environment: the second file used by the operating system during logon. before the system reads your own profile, it sets the environment variable of the environment file.

3 ,~ /. Bash_profile: The third file used for logon is. profile file. each user can use this file to input shell Information dedicated to their own use. when a user logs on, this file is only executed once! By default, it sets some environments to change the game volume and execute the user's. bashrc file.

4./etc/bashrc: execute this file for every user running bash shell. When bash shell is opened, the file is read.

5 ,~ /. Bashrc: This file contains bash information dedicated to your bash shell. This file is read when you log on and every time you open a new shell.

To make the set environment variables take effect immediately, use the source command, for example:

Copy codeThe code is as follows:
Source/etc/environment

To add commands in a directory to a shortcut, use this method. for example, I want to add the commands in the tools Directory of Android SDK:

Copy codeThe code is as follows:
Sudo ln-sf ~ /Android/sdk/tools/*/usr/bin /.

In this way, you can directly execute commands such as draw9path.

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.