How can I permanently export a variable in Linux?

You can add it to your shell configuration file, e.g., $HOME/.bashrc or more globally in /etc/environment.

After adding these lines, the changes won’t reflect instantly in GUI-based systems. You have to exit the terminal or create a new one and on the server, log out the session and log in to reflect these changes.

Leave a Comment