Change language in linux terminal

How do I change the language of the console permanently?

Is there a way I can change the language of the console? I have seen things such as adding LANG=C in front of the commands but that is a temporary fix. I can live with the Turkish console but when it comes to man and help commands it drives me nuts. I do not understand the Turkish terms used.

@Pilot6 that is not my problem. I want English to be my permanent language for the terminal. I don’t want to switch my keyboard layout. So not a duplicate of (askubuntu.com/questions/637148/…)

@JacobVlijm Layout? I am talking about the language the terminal uses to output data to me. I am not talking about my keyboard layout. Just a Menu+Space fixes that(altough I am used to Alt+Shift from windows).

3 Answers 3

Run the following command to save it in your ~/.bashrc file so that every time you open an interactive non-login terminal your locale will be set accordingly:

echo 'export LANG=C' >> ~/.bashrc 

Note that the C locale uses an ASCII character set, if you want Unicode then use a locale that supports it e.g.:

echo 'export LANG=en_US.UTF-8' >> ~/.bashrc 

To make changes available from the running session, source the ~/.bashrc file:

@heemayl I think for most tasks that the user needs, ~/.bashrc will be sufficient. It works for be in both ttys and graphical terminal,so . . .

I wish it would have worked. It did not. I checked the non login terminal. It did work there. I might want to try @Serg ‘s answer for this.

Put that into your ~/.bashrc file, where you define the prompt. Example:

So, basically in your homefolder, you can create .bashrc file, which is read by bash every time you open terminal. For example, I use it to define my prompt as PS1=’ serg@ubuntu ‘ . If I want a command to be run there every time I open terminal or run something in terminal, I add $( command ) to that PS1=’serg@ubuntu’ line, just like i showed.

I have a file in my ~/bin folder to get gnome-terminal in English:

$ cat ~/bin/gnome-terminal #!/bin/sh export LANGUAGE=en_US exec /usr/bin/gnome-terminal $@ 

( ~/bin is the first item in $PATH if it exists)

Please note that since the LANGUAGE variable is set more often than not in Ubuntu, and since gnome-terminal uses gettext, it’s LANGUAGE which needs to be changed, not LANG.

Источник

Changing Linux System Language (Locales) From Command Line on Ubuntu and Debian Based Distros

It’s been some time since I wrote something on It’s FOSS. The truth is that I’ve been writing for a Spanish version of It’s FOSS. If you’ve not visited it and/or you’re a Spanish speaker, please visit It’s FOSS en Español and check all the Linux content in Spanish.

You may be wondering why I’m sharing this fact with you. It’s because this post includes this new page as an example.

Читайте также:  Linux bash for files

At the time of doing a clean installation of your favorite Linux distro, the system asks you to choose a main language. Even though it’s not frequent, some people consider changing that language to a new one later on, like me for example.

See, I have to take screenshots in both Spanish (for It’s FOSS en Español) and in English (for It’s FOSS). This becomes a problem, because I have only one computer, and changing the user is not a fast solution for me.

That’s why I’d like to share with you this quick tip, where I’ll show you how to change your main system language with two simple lines in the terminal.

Changing Linux system language from the terminal

Let’s suppose you want to change your main language from English to Spanish.

Verify which language you have set as default (main language). For this, let’s use the locale command.

You should see something like this.

[email protected]:~$ locale LANG=en_US.UTF-8 LANGUAGE= LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=

Here you can see that the main language is English. Now to change it, use the dpkg command in this fashion:

sudo dpkg-reconfigure locales

Once you run the command before, you should see the next screen in your terminal.

sudo dpkg reconfigure locales

Here, you should move using the up and down arrow until you reach the desired language. In my case, I desire Spanish, and more specific, Mexican Spanish because I’m Mexican.

Not all languages may have the options, but if yours have, opt for UTF-8.

Once your language has been found, press the SPACE KEY to mark it and then ENTER.

selecting your language

Finally, select this new language as your default by moving to it using the arrow key and pushing the ENTER KEY, in the last windows.

setting new language as default 1

Once done, you should see a message like this in your terminal:

Generating locales (this might take a while). en_US.UTF-8. done es_MX.UTF-8. done Generation complete.

And that’s all! Now you’re able to change your default language as many times you want directly from the terminal.

Please let us know if you have any doubt about this topic in the comments section. Good look!

Источник

How to change language only for terminal

I’m using Arabic as the default language but there are some issues when displaying it in terminal. So I want to change the language only in terminal to English, how can I do that ?

@JacobVlijm: Since this question is about displayed language, the question about input language is probably not a duplicate.

3 Answers 3

to the end of your ~/.bashrc file and restart the terminal.

All program output will be in English.

You can just type this line as command in your open terminal session to change the language only inside this window and only until you close it. New windows will not be affected. To only run a single command in English, you can write the LANG=C directly in front of the command itself, e.g. LANG=C sudo apt-get update . @Pilot6: Maybe you want to edit that into your answer.

Читайте также:  Виндовс медленнее чем линукс

@ByteCommander It is obvious that you can type it each time. The whole point is to set English output to all terminal commands. That was the question.

this had changed all the system language at restart. Is there any way to change only terminal language ?

@Burawi I updated the command. It works for me. It changes output only in terminal. It does not affect GUI.

An Alternative approach is to run this:

For more permanent solution for you own user account only just put the command above into ~/.bashrc file

You will see the change in your next terminal session. For an immediate change without the need of a new terminal session run:

In case of multiple terminal sessions (eg. using terminator) you will need to run the command above on each one of them.

So any terminal related error message will be in English (as fas as any gnu-utils related software).

Источник

Switch command output language from native language to english

How can I switch the command output language from my native language to English, so I can post my Ask Ubuntu question with English command output (error messages)?

This is somewhat misleading. It is not actually necessary for people to do this. (If you think we should require OPs to burden themselves this way, please post on meta before instructing anyone to do so.) They can change LANG like this, and it might help, but we do not require copied error messages to be in English. We require what the author has written to be in English (though we usually translate it instead of closing questions). So a question written in English with Spanish terminal text is fine, while a question written in Spanish with English terminal text is not.

I agree, it is useful for people to be able to do this, and good you’ve posted this question! However, it’s important people know we don’t require them to do this (but do require that questions and answers themselves be written in English).

@EliahKagan On the contrary, it is very important to post actual error messages, and highly preferable to post them in English because that’s what the main audience of this site can recognize and test. (And never, ever post a re-translated error message. Always copy-paste, because the exact wording, punctuation, even spacing can be significant.)

9 Answers 9

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

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

Thats is problematic if you may want have output in other language than english. I did not be able to use any accentued character after this setting. askubuntu.com/a/818241/227400 was better.

It stops working after you close Konsole and open a new one. The new Konsole is in the old (non-English) language

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=$case $ 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" "$: unknown 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" "$"; 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.

Читайте также:  Linux zip files using tar

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

Источник

How can I change language but only for the terminal?

How do I change the language of the terminal to English? I am familiar with using vi . If the terminal language is controlled by etc/default/locale , what am I supposed to change there?

LANG="el_GR.UTF-8" LANGUAGE="el:en" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" 

2 Answers 2

Tl; dr

since you want to set everything to English (assuming that programs using GNU gettext should use Greek as a fallback language):

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

Or if some LC_* variables are defined already in your shell’s environment and you wish to override them:

export LC_ALL=en_US.UTF-8 export LANGUAGE=en:el 

To make the settings stick, add the export s at the end of ~/.bashrc .

Changing /etc/default/locale will affect the whole system’s locale and consequently the locale of all users who didn’t set a specific locale, so you shouldn’t change it if you want to change only the language of the command running in your user’s terminal / console.

The locale of the commands running in your user’s terminal / console can be changed by exporting the following environment variables:

LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME 

LANG defines the value to be used for each non-explicitly defined LC_* variable; so if none of the LC_* variables is currently defined in your shell’s environment (that is the default behavior, if env | grep ‘^LC_’ doesn’t output anything it means that’s the case) and you wish to set the value of all the categories to en_US.UTF-8 , simply export LANG :

Otherwise you’ll have to either also override each previously defined LC_* variable or (alternatively, more easily) just export LC_ALL , which overrides any previously defined LC_* variable:

However programs using GNU gettext will rely on LANGUAGE rather than LANG / LC_ALL (unless LANG / LC_ALL is set to C ) and will set the language based on its content. LANGUAGE should define a list of colon-separated languages. If a translation for the first colon-separated language listed is not available, the program will try to use to the second colon-separated language listed etc; for example, to set English as the preferred language and Greek as a fallback language:

So in your case, since you want to set everything to English (assuming that programs using GNU gettext should use Greek as a fallback language):

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

Or if some LC_* variables are defined already in your shell’s environment and you wish to override them:

export LC_ALL=en_US.UTF-8 export LANGUAGE=en:el 

To make the settings stick, add the export s at the end of ~/.bashrc .

Источник

Оцените статью
Adblock
detector