21

I am French and use my Debian system in French.

However, I would like to have error messages in terminal in English. It allows me to post them on English speaking websites.

How can I change my locale to do so? I precise I don't want to have all my system in English.

3
  • 1
    export LANGUAGE=English Commented Dec 17, 2013 at 17:23
  • @StephaneChazelas Please precise the precise effect and impact of your command (perhaps in a answer more than in comment). Commented Dec 17, 2013 at 17:25
  • see also What does “LC_ALL=C” do? Commented Dec 17, 2013 at 17:30

4 Answers 4

19

You have to change LANG and LANGUAGE variable in current shell.

Put

export LANG=en_US.UTF-8 export LANGUAGE=en 

in your shell rc file ( for bash it is ~/.bashrc ) and restart the terminal session ( or just source the rc file one more time with source ~/.bashrc or even just restart bash with exec bash )

Note, that you have to generate this locale before.

Also you can use export LANG=C.

Also there are other LANG variables (from man bash):

 LANG Used to determine the locale category for any category not specifically selected with a variable starting with LC_. LANGUAGE Used to set messages languages (as LC_MESSAGES) to a multi-valued value, e.g., setting it to fr:de:en will use French messages where they exist; if not, it will use German messages, and will fall back to English if neither German nor French messages are available. LC_ALL This variable overrides the value of LANG and any other LC_ variable specifying a locale category. LC_COLLATE This variable determines the collation order used when sorting the results of pathname expansion, and determines the behavior of range expressions, equivalence classes, and collating sequences within pathname expansion and pattern matching. LC_CTYPE This variable determines the interpretation of characters and the behavior of character classes within pathname expansion and pattern matching. LC_MESSAGES This variable determines the locale used to translate double- quoted strings preceded by a $. LC_NUMERIC This variable determines the locale category used for number formatting. 
2
9

You can call an application with the following syntax:

For example you want the English manpages (for just a single command):

user@host:~# LC_ALL=C man ls 

Or you run into an error (my system is in German):

user@host:~$ ls -la /root/ ls: Öffnen von Verzeichnis /root/ nicht möglich: Keine Berechtigung user@host:~$ LC_ALL=C ls -l /root/ ls: cannot open directory /root/: Permission denied 
3
  • Useful (but I accepted another answer because my question was about permanently doing this). Commented Dec 17, 2013 at 17:30
  • 2
    more "C" than "c", "c" doesn't work on my Debian 8. Commented May 10, 2017 at 9:19
  • I suggested an edit for LC_ALL=C instead of LC_ALL=c which fails too for me with message bash: warning: setlocale: LC_ALL: cannot change locale (c) Commented Sep 8, 2018 at 19:01
1

If you just want the error messages and not the whole locale, you can use:

export LC_MESSAGES=C

1
  • yes, a suitable temporal setting until the next reboot. :-) Commented Oct 20 at 10:47
-2

Try referencing this: 1) https://wiki.debian.org/ChangeLanguage

In short, you want to set your LOCALE (via LANG), preferrably in your .bashrc.

export LANG=en_US.UTF-8 
4
  • ok but I don't want to change my system language. I just want to have some error message in English. Changing the system language has plenty of consequences. Commented Dec 17, 2013 at 17:26
  • I beleive putting it in your .bashrc will only affect your shell, as well as any commands that read the .bashrc. If you omit "export", it will not be propagated to commands you start from that shell. Commented Dec 17, 2013 at 17:29
  • @ckelly That changes a bunch of things besides the error message language. For example, sort orders, number formatting, ... Commented Dec 17, 2013 at 17:30
  • @ppr ok, but I don't want to change my system language — Why then did you accept an answer which gives the same "solution"? Commented Feb 15, 2017 at 17:52

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.