1. 程式人生 > >mac終端中顯示tree的命令

mac終端中顯示tree的命令

尋覓了良久終於找到了mac下如何在終端顯示tree的命令了,作為從linux下轉過來的人,還沒適應mac的finder,還是喜歡在命令列下檢視檔案。

命令:

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

然後手動alias一下,在你的.bash_profile或者.zshrc中新增:

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

搞定

http://the5fireblog.b0.upaiyun.com/staticfile/Snip20131105_23.png

要是能顯示顏色和控制層級就更好了。

PS:也可以通過brew install tree 安裝。