In my ~/.profile
, I have:
export LANG=C.UTF-8
I think that was the Ubuntu default.
However, when I start a shell (e.g. Konsole), I get:
gz@gcomputer:~$ echo $LANG
de_DE.UTF-8
Even when I change my ~/.profile
to export LANG=en_US.UTF-8
, I don't get a difference.
Why? How can I fix this?
According to this answer You should change language settings in
etc/default/locale
and~/.pam_environment
, not in~/.profile
etc/default/locale
is generated byupdate-locale
so you do this to setLANG=en_GB.UTF-8
(the file also sets LANGUAGE)In ~/.pam_environment language settings look the same as in
/etc/default/locale
:and can be edited as desired. You have to log out and back in or use
source
:In general you have to log out and log back in for changes made to
~/.profile
to take effect.However, you can make them instant using
source
Example:
I edit my ~/.profile to include:
save and exit...
in a new shell:
(nothing)
If nothing changed after logging out and back in, check that
~/.bash_profile
and~/.bash_login
do not exist (because, as mentioned by @ByteCommander, if they do exist,~/.profile
is not sourced)If either do exist, the best thing to do is probably to copy any commands from them into your
~/.profile
and rename them something like~/.bash_profile_old
and~/.bash_login_old
, so that~/.profile
gets sourced (and you are not depending on bash being your shell)If neither of them exist, it may be that
~/.profile
is still not getting sourced for some reason:See Eliah Kagan's answer here for more detail
The suggested workaround is to use...
~/.pam_environment
For reasons too tedious to get into here, bash has several per-user configuration files. The most important two are
.profile
and.bashrc
. Bash reads one or the other of them on every startup, but not both, depending on conditions which are too confusing for me to bother remembering.What I do instead is put everything meaningful in
.profile
, plus an extra line readingand then I have a
.bashrc
consisting just ofIf you adopt this approach, it is important to make sure that everything
.profile
does is idempotent, which is a fancy word for "doing this more than once is the same as doing it only once. One easy way to accomplish that is to wrap the entire contents of.profile
in a similar conditional:(If you have files named
.bash_profile
or.bash_login
, that confuses the issue further: I strongly recommend copying their contents into.profile
, deleting them, and then cleaning up any duplication in.profile
.)