先确保安装了Homebrew

以下命令安装Homebrew

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

安装tree命令

brew install tree

效果

nixs@nixs-iMac Desktop % cd /Users/nixs/Desktop/smartposapp_ios日常Res
nixs@nixs-iMac smartposapp_ios日常Res % tree -N -L 1
.
├── 2018年
├── 2019年
├── 2020年
├── Spring源码深度解析.pdf
├── WechatIMG10.jpeg
└── cn_windows_10_business_edition_version_1809_updated_sept_2018_x64_dvd_84ac403f.iso

3 directories, 3 files
nixs@nixs-iMac smartposapp_ios日常Res % ls
2018年
2019年
2020年
Spring源码深度解析.pdf
WechatIMG10.jpeg
cn_windows_10_business_edition_version_1809_updated_sept_2018_x64_dvd_84ac403f.iso
nixs@nixs-iMac smartposapp_ios日常Res %

 

解析:

  • -N 能显示中文,不至于乱码
  • -L n(n代表深度)要显示列举多少层