Switch command output language from native language to english

export LC_ALL=C is enough. All subsequent command output will be in English.

More information: What does "LC_ALL=C" do?

If you want to revert to the native language, unset the LC_ALL variable:

unset LC_ALL

bash function for terminal

Here is my bash function to switch between DE and EN locales.

You may extend this code with your preferred languages. To use this, put it in your ~/.bashrc (or ~/.bash_profile)-

Call it with _configure_locale EN to switch to English.

function _configure_locale() { # [profile]
    local profile=${1:-EN}
    case ${profile} in
      DE|DE_DE|de_DE)
          LC_ALL="de_DE.UTF-8"
          LANG="de_DE.UTF-8"
          LANGUAGE="de_DE:de:en_US:en"
          ;;
      EN|EN_US|en|en_US)
          LC_ALL="en_US.UTF-8"
          LANG="en_US.UTF-8"
          LANGUAGE="en_US:en"
          ;;
      *)
          echo "ALERT" "${FUNCNAME}: unknown profile '${profile}'"
          ;;
      esac
      LC_PAPER="de_DE.UTF-8"; # independent from locale
      LESSCHARSET="utf-8";    # independent from locale
      MM_CHARSET="utf-8"      # independent from locale
      echo "locale settings" "${LANG}";
      export LC_ALL LANG LANGUAGE LC_PAPER LESSCHARSET MM_CHARSET
}

In general I suggest to change all 3 environment variables LC_ALL, LANG, LANGUAGE to avoid misbehaviours of some programs.

Adapting to your language

Extending the code to your native language is quite simple. You can find the needed values by invoking the following command

env |egrep -e 'LC_ALL|LANG'

Open a terminal Ctrl+Alt+T and type:

LANG=en_US.UTF-8 bash

or:

LC_ALL=C bash

Now the terminal output is in english language. You can check it with locale.

It is possible to make a command to do that with a permanent alias. Open the .bashrc file with your preferred editor and put the following code in there:

alias basheng='LANG=en_US.UTF-8 bash'

or:

alias basheng='LC_ALL=C bash'

Restart the Bash shell. Now you have the command basheng. Type it in the Bash to get an english Bash shell. To leave the english shell type exit.

Source:

  • Change the Language in a Linux (BaSH) Shell
  • export LC_ALL=C
  • Creating permanent executable aliases