tree命令报错引发的思考与启示

ubuntu@shenzhen:~ $ tree .
sed: read error on .: Is a directory
ubuntu@shenzhen:~ $ command tree

Command 'tree' not found, but can be installed with:

sudo apt install tree

ubuntu@shenzhen:~ $ sudo apt install tree
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  tree
0 upgraded, 1 newly installed, 0 to remove and 63 not upgraded.
Need to get 43.0 kB of archives.
After this operation, 115 kB of additional disk space will be used.
Get:1 http://mirrors.cloud.aliyuncs.com/ubuntu focal/universe amd64 tree amd64 1.8.0-1 [43.0 kB]
Fetched 43.0 kB in 0s (2,654 kB/s)
Selecting previously unselected package tree.
(Reading database ... 115945 files and directories currently installed.)
Preparing to unpack .../tree_1.8.0-1_amd64.deb ...
Unpacking tree (1.8.0-1) ...
Setting up tree (1.8.0-1) ...
Processing triggers for man-db (2.9.1-1) ...
ubuntu@shenzhen:~ $ tree .
sed: read error on .: Is a directory
ubuntu@shenzhen:~ $ command tree .
.
├── a
├── A

0 directories, 2 files
ubuntu@shenzhen:~ $ type tree
tree is aliased to `find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g''

原因是因为ubuntu里面并不自带tree命令,刚开始输入的tree只是bash-it实现的一个别名,然后bash-it存在bug它只能运行最原始的不带参数的tree所以报错,要查看命令的本质可以使用type命令,要直接执行原生的命令可以使用command命令。

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值