Configuration of Ubuntu Environment Variables

Source: Internet
Author: User
On Ubuntu, I used the Android adb tool to find that the environment variable has a problem. I checked the configuration of the environment variable in Linux on the Internet and learned about the configuration file of the environment variable, here, the files that can be configured with environment variables are as follows: 1. /etc/profile: Global first, applicable to all shells. The first file used to configure user preferences in the operating system during logon, this file sets the environment information for each user in the system. When the user logs on for the first time, this file is executed to set the shell.

On Ubuntu, I used the Android adb tool to find that the environment variable has a problem. I checked the configuration of the environment variable in Linux on the Internet and learned about the configuration file of the environment variable, here, we will talk about the files that can configure environment variables:

1. /etc/profile: Global first, applicable to all shells. The first file used to configure user preferences in the operating system during logon, this file sets the environment information for each user in the system. When the user logs on for the first time, this file is executed to set the shell. You can configure the environment variable here.

2./etc/environment: the second file used by the operating system during logon. The system configures the file system environment before reading your own profile. I usually set some global variables here. ubuntu's default PATH is in this file, and I will put the adb PATH here. (PS: the above two changes need to be restarted)

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. /Etc/bashrc: execute this file for every user running bash shell. When bash shell is opened, the file is read.

4 .~ /. 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.

Common commands:

Echo: echo $ PATH can be used to display environment variables

Export: Set Some environment variables export PATH = "$ PATH:/my_new_path"

Env: Display All environment variables

Set: display all locally defined Shell Variables

Unset: Clear environment variable unset $ PATH

Readonly: readonly PATH

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.