1. Use the ENV command to display all environment variables $ env hostname=redbooks.safe.org pvm_rsh=/usr/bin/rsh Shell=/bin/bash term=xterm histsize=1000. .. 2. Use the SET command to display all locally defined shell variables $ set3. Use the unset command to clear the environment variable set to set the value of an environment variable. Clear the value of the environment variable with the unset command. If no value is specified, the value of the variable is set to NULL. Examples are as follows: $ export test= "test ..." #增加一个环境变量TEST $ env|grep Test #此命令有输入, proving that the environment variable test already exists test=test ... $ unset $TEST #删除环境变量TEST $ env|grep Test #此命令没有输出, proving that the environment variable test already exists 4. Use the echo command to view a single environment variable. For example: Echo $PATH 5. Common environment variables PATH determines which directories the shell will look for commands or programs home current user home directory histsize history number LOGNAME Current user's login HOSTNAME refers to the name of the host SH ELL The current user shell type Languge language-related environment variables, multiple languages can modify this environment variable mail current user's message storage directory PS1 basic prompt, for the root user is #, for ordinary users is $6. Set a new environment variable HELLO $ export hello= "hello!" $ echo $HELLO hello!
Setting and viewing Methods for "Go" Linux environment variables