13

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.

10

You have to change LANG variable in current shell.

Put

export LANG=en_US.UTF-8

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_.
   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.
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
  • Useful (but I accepted another answer because my question was about permanently doing this). – ppr Dec 17 '13 at 17:30
  • 2
    more "C" than "c", "c" doesn't work on my Debian 8. – Tristan May 10 '17 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) – el-teedee Sep 8 '18 at 19:01
-3

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
  • 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. – ppr Dec 17 '13 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. – C. Kelly Dec 17 '13 at 17:29
  • @ckelly That changes a bunch of things besides the error message language. For example, sort orders, number formatting, ... – derobert Dec 17 '13 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"? – Piotr Dobrogost Feb 15 '17 at 17:52

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.