You should look at the presence and content of the file /root/.profile
.
The init file ~/.bashrc
is not sourced in login shells: on Ubuntu it is sourced from ~/.profile
Furthermore, the file /root/.profile
is not copied from /etc/skel/
as for other users, it is instead copied from /usr/share/base-files/dot.profile
during installation of package base-files
.
~/.bash_profile
is only sourced by bash when started in login mode. That is typically when you log in at the console (Ctrl+Alt+F1..F6), connect via ssh, or use sudo -i
or su -
to run commands as another user.
When you log in graphically, ~/.profile
will be specifically sourced by the script that launches gnome-session (or whichever desktop environment you're using). So ~/.bash_profile
is not sourced at all when you log in graphically.
When you open a terminal, the terminal starts bash in (non-login) interactive mode, which means it will source ~/.bashrc
.
The right place for you to put these environment variables is in ~/.profile
, and the effect should be apparent next time you log in.
Sourcing ~/.bash_profile
from ~/.bashrc
is the wrong solution. It's supposed to be the other way around; ~/.bash_profile
should source ~/.bashrc
.
See DotFiles for a more thorough explanation, including some history of why it is like it is.
(On a side note, when installing openjdk via apt, symlinks should be set up by the package, so that you don't really need to set JAVA_HOME
or change PATH
)
Best Answer
On my 14.04 VM, I found it in
/usr/share/bash-completion/bash_completion
:This is sourced by
~/.bashrc
:This can be figured out by running
bash -x
, which shows all sourced startup files and their commands. Runscript -c "bash -x"
, thenexit
in the new interactive shell, then examine thetypescript
file output from script:The
+
's indicate the level of sourced file, so when we look one level up from theshopt
command, we see/usr/share/bash-completion/bash_completion
is sourced.