How to set environment variable globally on Linux - 在Linux 上如何設定環境變數

May 1, 2024·
Chi Yau
Chi Yau
· 1 min read
post Linux

解法方法:

sudo nano /etc/environment

e.g.

ENV_1=abcxyz
ENV_SECRET="This is the secret"

之後reboot 個 System

sudo reboot now

用以下指令去試下有沒有成功加這個新的 environment variable

echo $ENV_1

Hope you find it useful

Chi Yau
Authors
App Dev
I’m Chi, a passionate tech enthusiast exploring the latest innovations in GenAI, LLMs, web development, performance tuning, and cybersecurity. As a tech guy at a startup, I aim to share my experiences, insights, and lessons learned in the fast-paced world of technology. Join me on this journey as we dive into the exciting challenges and triumphs of building and scaling tech solutions!