When using Linux systems such as Ubuntu, you often need to switch to the text Console (Press Ctrl + Alt + F [1-6]), but if the system uses Chinese by default, garbled characters are displayed in the Chinese prompt on the text console, and Chinese characters are displayed in the graphic console. So I thought I could not display the English prompt in the text Console (after all, if zhcon is not installed, it would not display Chinese, but it would be better to display English), and display Chinese in the graphic console, this is actually VeryGood. After online search, you can find that
When using Linux systems such as Ubuntu, you often need to switch to the text Console (Press Ctrl + Alt + F [1-6]), but if the system uses Chinese by default, garbled characters are displayed in the Chinese prompt on the text console, and Chinese characters are displayed in the graphic console. So I thought I could not display the English prompt in the text Console (after all, if zhcon is not installed, it would not display Chinese, but it would be better to display English), and display Chinese in the graphic console, this is actually Very Good.
After searching online, you can find that using the "export LANG = C" command in the console can make the console prompt in English. However, in this way, the graphic console will also be in English. Is there any way to determine whether the text console or the graphic console is used now?
Haha, yes, that is, the environment variable "TERM". Enter "echo $ TERM" in my Ubuntu graphics console and the returned result is "xterm ", in the text console, "linux" is returned (the results may be different in different Linux systems, and I have not tested the results. You can define the results as needed ). Therefore, you only need to add the following judgment at the end of the ". bashrc" file:
- If ["$ TERM" = "linux"]; then
- ExportLANG=C
- Fi