In this post, I would demo how to solve
garbled characters problem when using
tree to print the directory structure:
[root@genuine-post-2 ~]# tree .
you get this result:
. ├── �\210\221们 └── �\213�\225 2 directories, 0 files
- macos 10.15 catalina
3. The solution
We can use this command to solve this problem:
[root@genuine-post-2 ~]# tree -N .
We get this:
. ├── 我们 └── 测试 2 directories, 0 files
4. Why did this work?
We can check why the command
tree -N works:
-N Print non-printable characters as is.
It just print the results of tree command as is.
In this post, I demonstrated how to solve the garbled characters problem when using tree command. Hope it helps for you.