zoukankan      html  css  js  c++  java
  • Mac 下如何使用 Tree 命令

    方式一

    Mac 系统下默认是不带这条命令的,执行下面这条命令也可以打印出树状结构。

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

    不想每次都输入这么长一条命令怎么办?用 alias 给这条命令指定一条别名,方法步骤如下:

    Step 1 :创建 .bash_profile 文件

    cd ~
    touch .bash_profile
    open .bash_profile

    Step 2:把下面的命令保存在这个文件中

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

    Step 3:执行下面命令

    source .bash_profile

    方式二

    安装 tree 命令

    brew install tree

    使用方法:

    tree                         #打印所有目录层级
    tree -L 2                    #遍历2层
    tree > README.md             #输出结果到 Markdown 文档 

    大功告成!找个目录试试直接 tree 吧!

  • 相关阅读:
    Git
    Spring
    Linux
    Linux
    Linux
    Linux
    Linux
    Linux
    Linux
    Linux
  • 原文地址:https://www.cnblogs.com/zhaowmm/p/6129342.html
Copyright © 2011-2022 走看看