Showing and Setting Environment Variables on CentOS7

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,

env

env

To show particular environment value, for example PATH,

echo $PATH

env

To set a custom environment value, for example bulafish=hi and verify,

export bulafish=hi
echo $bulafish

env

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.
env

REFERENCES:
https://tw.godaddy.com/help/centos-12295
Environment Variables