Detailed environmental variables bashrc, profile, environment under linux ubuntu

There are several files you can set the environment variable in Ubuntu

/ Etc / profile: when you log in, the first file used by the operating system to customize the user environment settings file for each user environment information system, when a user first logs in, the file is executed.

/ Etc / environment: The second file operating system at login, the system before reading your own profile, set the environment variable environment file

~ / .Profile: used when logging in the third file is .profile files, each user can use the file input information specific to shell their own use, when a user logs in, the default file is performed only once! next, he set some environment variables, execute .bashrc file users.

/ Etc / bashrc: each user to perform a file operation when the bash shell bash shell is opened, the file is read.

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

There are generally three ways to set environment variables:

A temporary set

export PATH=/home/yan/share/usr/local/arm/3.4.1/bin:$PATH

Second, the current user's global settings

Open ~ / .bashrc, add the line:

export PATH=/home/yan/share/usr/local/arm/3.4.1/bin:$PATH

to validate

source .bashrc

Third, the global settings for all users

$ vim /etc/profile

Inside adding:

export PATH=/home/yan/share/usr/local/arm/3.4.1/bin:$PATH

to validate

source profile

Test echo $ PATH

Details From the original  http://blog.sina.com.cn/s/blog_4b2169480100sklr.html

Guess you like

Origin blog.csdn.net/Leia21/article/details/90756488
Recommended