New answers tagged environment-variables
.profile is run at login but a new terminal window is not a login and instead runs ~/.bashrc. if you log out of your session and login again your .profile will have the desired effect and your new terminal sessions after the login will inherit these settings from the initial login.
For the program that you started with nohup, no, the variable won't be reset because you logged out (unless it's a program that watches for you logging out and then resets the variable, or some such weirdness). Each process has its own copy of environment variables. For a process X, other processes cannot typically change X's copy of variables without X's ...
I was using bash.bashrc because I wanted the setup process to be system wide, so putting it in ~/.profile, as Anthony suggested, was not the best solution for me. Additionally the setup script was located on an NFS, so I made symbolic link in /etc/profile.d that pointed to the location of the setup script on the NFS. Works great now!
You should set the environment variables in your ~/.profile. This file is sourced by display managers such as LightDM which start the X server and the rest of the graphical system. It’s also sourced by Bash (as long as ~/.bash_profile doesn’t exist) – and other POSIX shells – for non-graphical, i.e., network and console logins. The Ubuntu Wiki has lots of ...
You can find it on /etc/environment: $ cat /etc/environment PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games" So, just source it: $ source /etc/environment $ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
You are trying to run /etc/environment as a command. If you want to edit it, you can use nano or vim (if you are beginner I would recomend nano). Type STUDIO_JDK=/usr/lib/jvm/java-8-openjdk-amd64 inside and press Ctrl+O to save, then Ctrl+X to exit nano.
Top 50 recent answers are included