linux 输出目录接口树_如何在Linux上使“树”输出保持一致

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方法应更可移植,以在更广泛的设备上正确显示。

Answered by Eric Z Ma.
埃里克·马(Eric Z Ma)回答。

翻译自: https://www.systutorials.com/how-to-make-tree-output-consistent-on-linux/

linux 输出目录接口树

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值