Har*_*uri 8 command operating-system
我尝试使用 tree 命令查看目录结构,但它无法在我的 mac 终端上工作,它说:找不到命令。我尝试使用 $brew install tree 安装命令包。它也不起作用???
小智 13
为什么不自己做?打开~/.bash_profile或~/.bashrc或/etc/bashrc(打开那个sudo)并在底部添加以下行:
alias tree='find . -print | sed -e "s;[^/]*/;|____;g;s;____|; |;g"'
Run Code Online (Sandbox Code Playgroud)
现在注销并重新登录,您的tree命令应该可以工作 - 尽管缺少该实用程序的某些功能,毫无疑问:)
我对此进行了测试,但感谢http://osxdaily.com/2016/09/09/view-folder-tree-terminal-mac-os-tree-equivalent/提出这个想法。
小智 12
brew install tree
Run Code Online (Sandbox Code Playgroud)
Windows 和 Linux 已经有这个功能,所以 Mac 需要安装。
参考:https : //superuser.com/q/359723