From: http://blog.sina.com.cn/s/blog_688077cf01013qrk.html
View and add path environment variables under Linux
From: http://apps.hi.baidu.com/share/detail/32942984
$PATH: determines which directories the shell will look for commands or programs, the value of PATH is a series of directories, and when you run a program, Linux searches for compiled links in these directories.
Edit your PATH declaration in the following format:
Path= $PATH: <path 1>:<path 2>:<path 3>:------: <path n>
You can add the specified path yourself, separated by a colon. When the environment variable is changed, it takes effect the next time the user logs on, and if you want to take effect immediately, you can execute the following statement: $ source. bash_profile
It is important to note that it is best not to put the current path "./" in path, which may be subject to unexpected attacks. When you are finished, you can view the current search path through the echo $PATH. With this customization, you can avoid frequent launches of programs that are outside the path of the shell search.
Feature Description: Sets or displays environment variables. (for example, we want to use a command, but the execution of this command is not in the current directory, so we must specify the directory to execute the file each time we use, trouble, in the code to execute the export first, this is equivalent to telling the program, executing a certain thing, Required files or something in these directories) but the environment variables that it inserts are not present when you log out again.
Use the Export command to view the path value
[Email protected] u-boot-sh4]# export
Declare-x cvs_rsh= "SSH"
Declare-x display= ": 0.0"
Declare-x g_broken_filenames= "1"
Declare-x histsize= "1000"
Declare-x home= "/root"
Declare-x hostname= "localhost"
Declare-x inputrc= "/ETC/INPUTRC"
Declare-x lang= "ZH_CN. UTF-8 "
Declare-x lessopen= "|/usr/bin/lesspipe.sh%s"
Declare-x logname= "Root"
Declare-x ls_colors= "no=00:fi=00:di=00;34:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi= 01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar= 00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*. z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00 ; 35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35: "
Declare-x mail= "/var/spool/mail/root"
Declare-x oldpwd= "/root"
Declare-xPATH= "/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"
Declare-x pwd= "/opt/stm/stlinux-2.3/devkit/sources/u-boot/u-boot-sh4"
Declare-x shell= "/bin/bash"
Declare-x shlvl= "1"
Declare-x ssh_askpass= "/usr/libexec/openssh/gnome-ssh-askpass"
Declare-x term= "Xterm"
Declare-x user= "Root"
Declare-x xauthority= "/root/.xauthkszh7b"
To view the PATH environment variables separately, you can:
[Email protected] u-boot-sh4]#echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
Add the PATH environment variable, which is available:
[Email protected] u-boot-sh4]#export path=/opt/stm/stlinux-2.3/devkit/sh4/bin: $PATH
Check again:
[Email protected] u-boot-sh4]# echo $PATH
/opt/stm/stlinux-2.3/devkit/sh4/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin :/bin:/usr/sbin:/usr/bin:/root/bin
Description Add path succeeded.
the path of the above method disappears after the terminal is closed. So it is recommended to edit the/etc/profile to change the path, you can also change
the. BASHRC (i.e.: ~/.BASHRC) in the home directory. The second method: #
Vim/etc/profile
at the end of the document, add:ExportPath= "/opt/stm/stlinux-2.3/devkit/sh4/bin: $PATH" Save, Exit, and run: #
Source/etc/profile
No error is successful.
You can use the unset+ environment variable to clear export to insert in-memory environment variables.
View and add path environment variables under Linux