Set environment variables in Ubuntu

Source: Internet
Author: User

The following files can be used to set environment variables in Ubuntu:

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

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

~ /. 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 environment variables to 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.

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

There are three methods to set environment variables:
I. Temporary settings
Export Path =/home/Yan/share/usr/local/ARM/3.4.1/bin: $ path

Ii. Global settings of the current user
Open ~ /. Bashrc, add row:
Export Path =/home/Yan/share/usr/local/ARM/3.4.1/bin: $ path

Make effective

Source. bashrc
3. Global settings for all users
$ Vim/etc/profile
Add:
Export Path =/home/Yan/share/usr/local/ARM/3.4.1/bin: $ path
Make effective
Source Profile

Test echo $ path

 

Original URL: http://www.kklinux.com/html/Love-Linux/Suse-Linux/200909/03-6076.html

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.