DEV Community

gourab yousuf basir
gourab yousuf basir

Posted on • Updated on

Create persistent env variable

To create an env variable and make it persisting, we need to edit .bash_profile file. The ~/.bash_profile file is a configuration file for configuring user environments.
Open terminal and run the following command to edit in nano. .bash_profile.

nano ~/.bash_profile
Enter fullscreen mode Exit fullscreen mode

Then enter your environment variable and export as bellow

export CLIENTID="mysecretclientidvalue"
Enter fullscreen mode Exit fullscreen mode

Save the file by pressing ctrl+o and enter.

Logout and login again to your ubuntu computer.
To check the env value has been persisted or not by entering this command:

echo $CLIENTID
Enter fullscreen mode Exit fullscreen mode

This will return the value of the env persisted variable.

Top comments (0)