The Ubuntu Linux system contains two types of environment variables: System environment variables and user environment variables. System environment variables are valid for all system users, and user environment variables are only valid for current users. Modifying user environment Variables
User environment variables are usually stored in the following file:
~/.profile
~/.bash_profile or ~./bash_login.
~/.bashrc
The above files are not recommended for use in Ubuntu 10.0 versions. System Environment Variables
System environment variables are generally saved in the following file:
/etc/environment
/etc/profile
/etc/bash.bashrc
/etc/profile and/ETC/BASH.BASHRC are not recommended for use in Ubuntu version 10.0. Adding environment Variables
If you want to add a path to the $path, you can do so (modify/etc/profile) as follows:
sudo vi/etc/profile
In the inside add:
java_home=/usr/jdk1.6.0_25
export java_home
path= $PATH: $JAVA _home/bin
export PATH
classpath=.:$ Java_home/lib
Export CLASSPATH
You can add multiple paths of your own, separated by colons. When the environment variable is changed, it will take effect the next time the user logs on, and if you want to take effect immediately, execute the following statement:
Source/etc/profile
It should be noted that it is best not to put the current path "./" Into the path, which may be subject to unexpected attacks.
Other files are modified in the same way, it should be noted that/etc/environment does not need to use export to set environment variables, other profile files need.
A more detailed description can be referred to here.
Of course, if you want to use the text Editing tool to modify the environment variables, you can use the root permission to open the Modify save directly with the text editor
You can also use the normal user rights to copy files to the desktop, and so on, with root rights cover back
#/etc/profile:system-wide Profiles file for the Bourne shell (SH (1))
# and Bourne compatible shells (Bash (1), Ksh (1) , Ash (1), ...).
if[-D/ETC/PROFILE.D]; Then
fori in/etc/profile.d/*.sh;do
if[-R $i] then
. $i
fi
done
java_home=/usr/hadoop/ jdk1.6.0_25
export java_home
path= $PATH: $JAVA _home/bin
export PATH
classpath=.: $JAVA _home/lib
export CLASSPATH
unseti
fi
if["$PS 1"]; then
if["$BASH"] then
# the file BASH.BASHRC Already sets the default PS1.
# ps1= ' \h:\w\$ '
if[-F/ETC/BASH.BASHRC] then
./etc/bash.bashrc
fi
else
if["' id-u '"-eq0] ; Then
ps1= ' # '
else
ps1= ' $ '
fi
fi fi
Original address: Click on the Open link