Home >Operation and Maintenance >Linux Operation and Maintenance >What to do if the Linux command line displays garbled characters
Solution to the garbled code displayed on the Linux command line: 1. Use the "echo $LANG" command to check the currently supported languages; 2. Use the "LANG=en_US" command to change the language to English to solve the garbled code problem.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
What should I do if the Linux command line displays garbled characters?
Linux (Ubuntu) garbled characters or diamonds appear when the command terminal is displayed
You can see that I am using the ls command and the output is garbled. This is a problem with language support. We You need to change the currently supported language
echo $LANG
UTF-8 is used to display Chinese encoding, but our The terminal cannot output data in Chinese encoding by default.
So we need to change the supported language to English.
LANG=en_US
At this time, check the currently supported language
Enter the command
echo $LANG
Yes See the successful modification
Enter the command againls -al
You can see that the garbled characters disappear
When garbled characters are displayed, you can change the language due to the problem of the currently supported language
View the currently supported language command
echo $LANG
Modify the supported language
LANGE=en_US
I just changed it to en_US language support. If it doesn't work, I suggest you check the supported languages
Related recommendations: "Linux Video Tutorial"
The above is the detailed content of What to do if the Linux command line displays garbled characters. For more information, please follow other related articles on the PHP Chinese website!