For some reason, we set values to Environment variable on our system so that our program can work accordingly. therefore I learn how to show and set environment variables.
To show all the current environment values,
1
env
To show particular environment value, for example PATH
,
1
echo $PATH
To set a custom environment value, for example bulafish=hi
and verify,
1
2
export bulafish=hi
echo $bulafish
The value is only validate for the current ssh session by using the command above. If you want to set the value permanently, modify /etc/environment
, after that, you must logout the current ssh connection and re-login again to make the change take effect.
REFERENCES:
https://tw.godaddy.com/help/centos-12295
Environment Variables