Linux Set Environment Variable

Date: 2025-02-17
User? ~/.bashrc of ~/.profile
Systeem? /etc/environment
Service? systemctl edit my-service


echo 'VARIABLE_NAME=value' | sudo tee -a /etc/environment
# reload
source /etc/environment

# /etc/profile of /etc/profile.d/custom_env.sh met:
export VARIABLE_NAME=value

# service
systemctl edit my-service

[Service]
Environment="VARIABLE_NAME=value"

92860cookie-checkLinux Set Environment Variable