centOS下的安装:bash
yum -y install tree
Ubuntu下安装:spa
sudo apt-get install tree
命令的使用:命令行
tree或者tree -a //显示当前目录下的全部文件和子文件 tree -f //在每一个文件或目录以前,显示完整的相对路径名称
mac下:code
第一种:一、直接使用find命令模拟出tree命令的效果,如显示当前目录的 tree 的命令:blog
find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'
第二种:写一个别名来快速执行该命令,运行以下命令,将上面这个命令写到~/.bash_profile里,之后直接运行tree命令就更方便了homebrew
alias tree="find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'"
第三种:使用 homebrew 安装 tree 命令行:get
brew install tree
————很是遗憾,第三种我没有尝试成功。class