The client tool is Xshell 6.

Garbled characters will appear as long as the command contains Chinese characters, such as this:

1 analysis

First look at the language package used by the current system:

 echo $LANG
Copy the code

Output result:

zh_CN.gbk
Copy the code

The system uses GBK, but the Xshell client uses UTF-8 by default. Therefore, Chinese garbled characters appear.

2 to solve

After connecting to the server, open the Earth icon in the toolbar and select GBK:

When you enter the command again, the Chinese characters in the command output are displayed normally:

Isn’t it easy