I need to change LC_NUMERIC to English (I have Ubuntu in Spanish) because of the dots and the commas, but if I use LC_NUMERIC="en_US.UTF-8" when I exit the terminal and I open it again, LC_NUMERICis again in Spanish.

Does anyone know how to solve this?

  • 3
    Have you tried update-locale LC_NUMERIC=en_US.UTF-8? – Ron Jan 22 '16 at 16:58

Append the value to your ~/.bashrc file:

echo 'export LC_NUMERIC="en_US.UTF-8"' >>~/.bashrc

To make it applicable from the current session of bash, source the ~/.bashrc file:

source ~/.bashrc

Example: Here i am changing from en_US.UTF-8 to C:

$ locale | grep LC_NUMERIC

$ echo 'export LC_NUMERIC="C"' >>~/.bashrc

$ source ~/.bashrc 

$ locale | grep LC_NUMERIC

This will change the locale for only the user running the command, for system wide change you need to add the value to /etc/default/locale, check the added portion below.

You can also add the value to the systmwide locale file, /etc/default/locale, which will be read at start. To put it there:

echo 'LC_NUMERIC="en_US.UTF-8"' | sudo tee -a /etc/default/locale


sudo bash -c 'echo "LC_NUMERIC=\"en_US.UTF-8\"" >>/etc/default/locale'
| improve this answer | |
  • Thank you!! It works perfectly, I installed Ubuntu one week ago and I am trying to figure out everything, really useful answer! – Maria Jan 22 '16 at 19:41
  • @Maria Glad i could help and of course welcome to the Ubuntu world !! – heemayl Jan 22 '16 at 19:42
  • You sure about that second command? Your echo will run as root, but the redirection is the current user, and that probably will not have acces to /etc/default/locale – Stephen Aug 26 '16 at 20:34
  • @Stephen The redirection (and echo) is running in a subshell (spawned by bash -c), not in the current shell, check the single quotes around. – heemayl Aug 26 '16 at 20:37
  • Ah, thanks. I didn't see the single quotes. You're absolutely right. – Stephen Aug 26 '16 at 20:38

Graphical logins do not read shell startup files ( ~/.bashrc, ~/.profile and so on ) by default and also should not because these are bash specific.

So it is better to use /etc/environment for system wide environment settings and ~/.xsessionrc for user specific settings.

PAM should by default read /etc/environment - check that

/etc/pam.d/login /etc/pam.d/sshd /etc/pam.d/su /etc/pam.d/cron

includes the line

session       required   pam_env.so readenv=1

-> https://wiki.debian.org/EnvironmentVariables

| improve this answer | |

The "official" technique to change locale settings for number formatting system-wide is:

sudo update-locale LC_NUMERIC=en_US.UTF-8

After that, restart your system.

If it still does not work, then probably your graphical desktop environment overwrites the system-wide locale settings. On a personal computer, it is best to configure it so that it does not modify the system-wide locale settings at all. How to do this depends on the desktop environment you use. I made instructions for LXQt for this.

Source: A comment by Ron above. I wanted to turn it into a proper answer as it's the official and most straight-forward technique.

| improve this answer | |

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.