1

For some strange reason, I find my I have several LC_ locale variables set to a value I don't recognize having chosen (en_ZA.UTF-8). So, I want to set it differently - permanently, from the command-line, and using the appropriate configuration file(s).

But which files are these? I would think it should be /etc/default/locale, at least at the system level. But in there I see:

#  File generated by update-locale
LANG="en_US.UTF-8"
LANGUAGE="en_US:en"

Are there other files Where LC_MONETARY, LC_TIME, etc. may be set? I grepped around and could find any suspects.

PS - I'm using Debian Stretch.

  • Any of the various shell startup files (/etc/profile, ~/.profile, etc...) as well as /etc/environment are good candidates for being the offender, but you might as well just try a wide search in all of /etc and your home directory if you're not in a hurry. There shouldn't be too many false matches for the string en_ZA :-) BTW, running stretch in 2016 is a bit of a stretch... – Celada Mar 28 '16 at 15:36
  • @Celada: Debian Stretch is the current Debian testing (Debian 9). Also, grep -r en_ZA /etc yielded nothing. – einpoklum Mar 28 '16 at 15:40
  • Uh, oops, I mixed it up with squeeze (which is getting pretty old, right?)! stretch, squeeze, squish, whatever, it's all deformations in toys :-) – Celada Mar 28 '16 at 15:42
2

Locale settings are conveyed through environment variables, so they can be set in any of the many places where environment variables can be set. /etc/default/locale is where the system default locale is recorded if you go through the system locale configuration interface, but settings could be in any other place where environment variables are set, such as (I'm just listing the most common ones):

  • /etc/profile
  • /etc/profile.d/*
  • /etc/environment
  • ~/.profile, or ~/.bash_profile or ~/.login or ~/.zprofile depending on your login shell
  • ~/.pam_environment
  • (for shells running in a terminal only) /etc/bash.bashrc, /etc/zshrc, ~/.bashrc, ~/.zshrc, etc.

Searching through the whole of /etc and your dot files should find it:

grep -rs en_ZA /etc ~/.[!.]*

Locale settings are set from LANG if unset, and LC_ALL trumps all. In the output of locale, settings are printed in double quotes if they're induced from LANG or LC_ALL as opposed to set explicitly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.