Skip to content

Instantly share code, notes, and snippets.

@Andreluizfc
Last active April 26, 2020 03:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Andreluizfc/0d61ccb30643bff2ca6d65e5994a3168 to your computer and use it in GitHub Desktop.
Save Andreluizfc/0d61ccb30643bff2ca6d65e5994a3168 to your computer and use it in GitHub Desktop.
Setting Persistent Global Environment Variables - Ubuntu

Setting Persistent Global Environment Variables

When an environment variable needs to persist globally across the entire system, we can set it in the default profile loaded by all users on the system.

All global profile settings are stored under /etc/profile. And while this file can be edited directory, it is actually recommended to store global environment variables in a directory named /etc/profile.d, where you will find a list of files that are used to set environment variables for the entire system.

Create a new file under /etc/profile.d to store the global environment variable(s). The name of the should be contextual so others may understand its purpose.

sudo touch /etc/profile.d/http_proxy.sh
sudo gedit /etc/profile.d/http_proxy.sh
export YOUR_VAR_NAME=your_var_value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment