When your system is not running on English, you may sometimes want to run some applications and not use your system locale.
Use cases are scripts that parse output, or just using the (possibly) more common English labels or error messages. Here is how to do that.
I will use the
date command and print the current weekday, just for the sake of an example.
Most often, setting
LC_ALL for your command should be enough. The following was run on a system using a German locale.
$ date +%A Montag $ LC_ALL=C date +%A Monday
C is usually fine to simply get English output (though there is more to it).
LC_ALL does not work, try using
LANG (if that still does not work, try
$ LANG=C date +%A Monday
There are also other (more specific) environment variables, like
You can list them using the
Note that you can only use locales that are actually available on your system.
LC_ALL=de will only work if there really is a "de" locale -- Ubuntu will not automagically guess something like
locale -a to list all available locales.
To generate other locales, use the
$ sudo locale-gen es_CR.utf8 Generating locales... es_CR.UTF-8... up-to-date Generation complete. $ LANG=es_CR.utf8 date +%A lunes