zoukankan      html  css  js  c++  java
  • mac 下的 tree 命令 终端展示你的目录树结构

    相信很多使用过Linux的用户都用过tree命令,它可以像windows的文件管理器一样清楚明了的显示目录结构。mac 下使用 brew包管理工具安装 tree

    前提:安装了homebrew(安装指令 

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    )

    brew install tree

    正常的显示开始安装(这才是开始下载)

     Downloading https://homebrew.bintray.com/bottles/tree-1.8.0.mojave.bottle.tar.gz

    如果报错

    Error: The following directories are not writable by your user:
    /usr/local/sbin
    
    You should change the ownership of these directories to your user.
      sudo chown -R $(whoami) /usr/local/sbin
    
    And make sure that your user has write permission.
      chmod u+w /usr/local/sbin

    要先按照上面的指令执行

    chmod u+w /usr/local/sbin
    
    sudo chown -R $(whoami) /usr/local/sbin  # 这里会让输入登录密码,输入即可
    

      

     

    安装成功后,直接在终端使用, 使用 --help 查看帮助信息

    tree --help


    在目录遍历时使用 -L 参数指定遍历层级
    tree -L 1  #-L 1 指只显示一级目录

    把一个目录的结构树导出到文件 Readme.md

    tree -L 2 >README.md

    如果要查看的目录包含中文,用:

    tree -N
  • 相关阅读:
    Angularjs html文本显示
    .net与.net core学习目录
    数据库学习目录
    WCF学习目录
    sql学习目录
    EF学习目录
    git for Windows
    图谱论(Spectral Graph Theory)基础
    2017机器学习相关会议时间
    数值分析教材统计
  • 原文地址:https://www.cnblogs.com/lyfstorm/p/11012134.html
Copyright © 2011-2022 走看看