Environment variables store configuration values that applications use at runtime.
View Environment Variables
# All variables
env
printenv
# Specific variable
echo $PATH
echo $HOMESet Variables (Current Session)
export MY_VAR="hello"
export PATH="$PATH:/opt/myapp/bin"Make Variables Permanent
Add to ~/.bashrc or ~/.profile:
echo 'export MY_VAR="hello"' >> ~/.bashrc
source ~/.bashrcSystem-Wide Variables
Add to /etc/environment or create a file in /etc/profile.d/:
echo 'MY_VAR="hello"' >> /etc/environment