Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have SSH access to a CentOS 6.3 box.

Some results on that SSH and I think the whole OS is localized to portuguese.

When I type date, for example, I get

Sex Fev 15 02:35:48 WET 2013

instead of

Fri Feb 15... bla bla

the timezone is correct but this localization in portuguese is giving me problems with scripts using date, because they are not recognizing this as a date.

how can I change the date back to english format?


edit: typing locale gives me this

share|improve this question
up vote 2 down vote accepted

You can set the LC_ALL variable to an english locale. Here is an example:

export LC_ALL=en_US.UTF-8

The locale must be present on the machine. If it is not, you can fallback to the POSIX C locale:

export LC_ALL=C

The POSIX specification describes how the locale variables should work.

share|improve this answer
ah, I see it now. Thanks! – SpaceDog Feb 15 '13 at 2:58

There are three levels of locale settings in the environment:

  • If LC_ALL is set, it trumps everything.
  • If an LC_xxx variable it sets and LC_ALL is unset, the value of LC_xxx applies to this category.
  • If neither LC_ALL nor the relevant LC_xxx is set, $LANG applies.
  • If none of the above applies, the locale is C (that's the most basic, no-frills locale).

As a user, you can define LANG and override a particular setting with LC_xxx. For example, to work in a Portuguese locale except with British dates:

export LANG=pt_PT.UTF-8 LC_TIME=en_UK.UTF-8

(Put that in your ~/.profile.)

Instead of setting LANG, you might set just the categories you're interested in. For example, to get messages in Portuguese and use the UTF-8 character set but leave other formats to their default value:

unset LANG

If you need to run a program that can't cope with locale variations, run it in the C locale.

LC_ALL=C troublesome_script
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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