Home >Operation and Maintenance >Linux Operation and Maintenance >What to do if the Linux command line displays garbled characters

What to do if the Linux command line displays garbled characters

藏色散人
藏色散人Original
2023-03-03 09:30:197924browse

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.

What to do if the Linux command line displays garbled characters

#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

Solution to garbled characters when displayed on the terminal

What to do if the Linux command line displays garbled characters

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

View the currently supported language command

echo $LANG

What to do if the Linux command line displays garbled characters
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.

Change the language to English

LANG=en_US

At this time, check the currently supported language
Enter the command

echo $LANG

What to do if the Linux command line displays garbled characters
Yes See the successful modification
Enter the command againls -al
What to do if the Linux command line displays garbled characters

You can see that the garbled characters disappear

Summary

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn