tree命令-树状结构打印目录
1 简介
tree命令可以以树状结构打印目录。本文简要介绍其在mac上的安装和使用。
2 安装
brew install tree
3 使用
3.1 最简单的例子
打印所有指定目录下的目录和文件(包括所有后代)
$ tree chengc-demos/
chengc-demos/
├── pom.xml
└── src
└── main
├── resources
│ └── log4j.properties
└── scala
└── com
└── chengc
└── demos
├── BatchJob.scala
└── StreamingJob.scala
3.2 只显示目录
$ tree -d chengc-demos/
chengc-demos/
└── src
└── main
├── resources
└── scala
└── com
└── chengc
└── demos
3.3 打印指定子层数
$ tree -L 3 chengc-demos/
chengc-demos/
├── pom.xml
└── src
└── main
├── resources
└── scala