Mac OSX下的tree命令

想查看当前文件夹的树状结构,在Linux里可以通过tree命令; 但是MAC下默认是没有 tree 命令!

下面介绍两种解决方法:

1、修改 ~/.bash_profile 配置文件

alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"

 

Mac系统: commond+shift+G -> 输入~/.bash_profile进入.bash_profile文件夹,加入上述代码:

2、通过brew命令安装tree组件 

iMac:springredis anthony$ brew install tree
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (caskroom/cask).

==> Downloading https://homebrew.bintray.com/bottles/tree-1.7.0.sierra.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring tree-1.7.0.sierra.bottle.1.tar.gz
  /usr/local/Cellar/tree/1.7.0: 7 files, 113.3KB

该方法我没有试过.

posted @ 2017-11-13 15:31  yuhui.Mr  阅读(1773)  评论(0)    收藏  举报