How to set, print, or list environment variables
from http://how-to.wikia.com/wiki/How_to_set,_print,_or_list_environment_variables
To set a environment variables
- For bourne shells sh, ksh, bash
- execute: VARNAME="value"; export VARNAME
Edit the ~/.bashrc to set the enviromental variables permanently.
Display environment variables
display/print/list environment variables
- To list all environment variables
- Execute: printenv
- To print a specific environment variable
- Execute: echo $Env_Var_Name
- Example: echo $PATH
- Execute: echo $Env_Var_Name
Common environment variables
- MANPATH=/usr/local/share/man:/usr/share/man
- HOSTNAME=localhost
- SHELL=/bin/bash
- TERM=xterm
- XTERM_SHELL=/bin/bash
- PATH=/usr/java/j2sdk1.4.2_01/bin:/bin:/sbin:/usr/sbin:/usr/bin:/usr/local/bin/::/usr/local/sbin
- EDITOR=/bin/nano
- BASH_ENV=/home/zymos/.bashrc
- INFOPATH=/usr/share/info:/usr/share/binutils-data/i686-pc-linux-gnu/2.16.1/info:/usr/share/gcc-data/i686-pc-linux-gnu/3.4.5/info
- DISPLAY=:0.0
- PKG_CONFIG_PATH=/usr/X11R6/lib/pkgconfig:/usr/local/lib/pkgconfig:/usr/qt/3/lib/
And the Set built-in command can be used to dump out all the existing variables.
posted on 2012-08-12 06:55 Jalen Wang 阅读(357) 评论(0) 编辑 收藏 举报