tree命令可以很方便的展示目录结构,但是macos并不支持,这时我们需要安装这个命令

首先需要安装homebrew

1
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

然后安装tree

1
brew npm install tree

安装完成,试试使用tree命令吧

1
tree -L 1

输出

1
2
3
4
5
6
7
8
9
10
.
├── Applications
├── Desktop
├── Documents
├── Downloads
├── Library
├── Movies
├── Music
├── Pictures
└── Public