Home ubuntu How to properly set environment variables in Ubuntu?

How to properly set environment variables in Ubuntu? [Duplicate]




Hello, I recently began to master this OS. If it was clear in Windows, where to prescribe environment variables (for Java, Gradle and Ant), then I have difficulties in Ubuntu. In the Acid documentation, it is written that you need to use the EXPORT command, but then after the session is completed, this variable flies. I understand that in order to register the variable in the ENV “Nasov” you need to specify it in some bash. But I really did not find a step-by-step instruction on the network (although I could not ask Guggle about what command to write to go to Bash and register the necessary variables. Please explain how to do it?

Answer 1, Authority 100%

ls ~

See there either .bashrc or .bash_profile
Open to change

nano ~ / .bashrc

At the end of the file to enter the necessary, for example,

export demo_env = success

Press Ctrl + x then Y and ENTER
After performing

source ~ / .bashrc

Answer 2, Authority 80%

There was an answer Here

  1. open the file / etc / environment
  2. Record the necessary variables:

    Export Var_Name = var_value

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions