linux 输出目录接口树
I tried tree
on different Linux boxes to verify the files by diff
. However, I found the format can be a little bit different on different nodes.
我尝试在不同的Linux机器上使用tree
来通过diff
验证文件 。 但是,我发现在不同的节点上格式可能有些不同。
For examples, the tree result could be
例如,树结果可能是
.
|-- test2
| |-- test4
| `-- test5
`-- test3
1 directory, 3 files
or
要么
.
├── test2
│ ├── test4
│ └── test5
└── test3
1 directory, 3 files
How to make them consistent. Either one actually works for me.
如何使它们一致。 哪一个实际上对我有用。
You can set the charset that will be used by tree
:
您可以设置将由tree
使用的字符集:
tree --charset=ascii
or
要么
tree --charset=utf-8
Tests on one Linux box:
在一个Linux机器上进行测试:
$ tree
.
├── test2
│ ├── test4
│ └── test5
└── test3
1 directory, 3 files
$ tree --charset=ascii
.
|-- test2
| |-- test4
| `-- test5
`-- test3
1 directory, 3 files
The tree --charset=ascii
method should be more portable to be shown correctly on a wider range of devices.
tree --charset=ascii
方法应更可移植,以在更广泛的设备上正确显示。
翻译自: https://www.systutorials.com/how-to-make-tree-output-consistent-on-linux/
linux 输出目录接口树