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.