一、安装

  1. 安装Brew,安装步骤
  2. 通过Brew安装Tree brew install tree

二、使用

进入需要展示的目录,可通过tree --help查看 tree 命令说明,如下所示:

usage: tree [-acdfghilnpqrstuvxACDFJQNSUX] [-H baseHREF] [-T title ][-L level [-R]] [-P pattern] [-I pattern] [-o filename] [--version][--help] [--inodes] [--device] [--noreport] [--nolinks] [--dirsfirst][--charset charset] [--filelimit[=]#] [--si] [--timefmt[=]<f>][--sort[=]<name>] [--matchdirs] [--ignore-case] [--fromfile] [--][<directory list>]------- Listing options --------a            All files are listed.-d            List directories only.-l            Follow symbolic links like directories.-f            Print the full path prefix for each file.-x            Stay on current filesystem only.-L level      Descend only level directories deep.-R            Rerun tree when max dir level reached.-P pattern    List only those files that match the pattern given.-I pattern    Do not list files that match the given pattern.--ignore-case Ignore case when pattern matching.--matchdirs   Include directory names in -P pattern matching.--noreport    Turn off file/directory count at end of tree listing.--charset X   Use charset X for terminal/HTML and indentation line output.--filelimit # Do not descend dirs with more than # files in them.--timefmt <f> Print and format time according to the format <f>.-o filename   Output to file instead of stdout.------- File options --------q            Print non-printable characters as '?'.-N            Print non-printable characters as is.-Q            Quote filenames with double quotes.-p            Print the protections for each file.-u            Displays file owner or UID number.-g            Displays file group owner or GID number.-s            Print the size in bytes of each file.-h            Print the size in a more human readable way.--si          Like -h, but use in SI units (powers of 1000).-D            Print the date of last modification or (-c) status change.-F            Appends '/', '=', '*', '@', '|' or '>' as per ls -F.--inodes      Print inode number of each file.--device      Print device ID number to which each file belongs.------- Sorting options --------v            Sort files alphanumerically by version.-t            Sort files by last modification time.-c            Sort files by last status change time.-U            Leave files unsorted.-r            Reverse the order of the sort.--dirsfirst   List directories before files (-U disables).--sort X      Select sort: name,version,size,mtime,ctime.------- Graphics options --------i            Don't print indentation lines.-A            Print ANSI lines graphic indentation lines.-S            Print with CP437 (console) graphics indentation lines.-n            Turn colorization off always (-C overrides).-C            Turn colorization on always.------- XML/HTML/JSON options --------X            Prints out an XML representation of the tree.-J            Prints out an JSON representation of the tree.-H baseHREF   Prints out HTML format with baseHREF as top directory.-T string     Replace the default HTML title and H1 header with string.--nolinks     Turn off hyperlinks in HTML output.------- Input options ---------fromfile    Reads paths from files (.=stdin)------- Miscellaneous options ---------version     Print version and exit.--help        Print usage and this help message and exit.--            Options processing terminator.

使用示例

  • 输出当前文件夹不包含node_modulesdist路径下的其他文件
  • 输出三层
  • 将输出文件保存到文件file_structure

指令如下:

tree -L 3 -I "node_modules|dist" >> file_structure

输出结果:

├── README.md
├── assets
│   └── README.md
├── components
│   ├── Logo.vue
│   └── README.md
├── file_structure
├── layouts
│   ├── README.md
│   └── default.vue
├── middleware
│   └── README.md
├── nuxt.config.js
├── package-lock.json
├── package.json
├── pages
│   ├── README.md
│   └── index.vue
├── plugins
│   └── README.md
├── server
│   └── index.js
├── static
│   ├── README.md
│   └── favicon.ico
└── store└── README.md

Tip:也可以使用简化版工具 ftmap 进行输出

MAC Tree 命令的使用相关推荐

  1. Mac下使用tree命令

    Mac下没有tree命令,但是可以通过brew进行安装,命令如下: brew install tree 装好后tree的用法和linux下的保持一致.参考:http://www.cnblogs.com ...

  2. mac使用tree命令

    brew install tree tree tree -L 1 # 深度1 tree ufo    # 展示子目录 find .| xargs grep -ri ""    # ...

  3. Mac OSX下的tree命令

    想查看当前文件夹的树状结构,但是mac下默认是没有 tree 命令 所以我们需要安装一下 安装 tree 命令 brew install tree 安装过程中发现 说是 下面的公式: 树 不能作为二进 ...

  4. (0012) iOS 开发之MAC 终端命令学习

    Mac 下经常使用终端命令行,看上去很高大上的感觉.自己对终端命令行不是很熟悉.所以下决心学习它.于是就记下自己使用的命令行!以备忘记时查阅. 用 Tab 键可以自动补齐 0. ctrl + umac ...

  5. Tree命令安装和使用

    Tree命令简介 tree是一种递归目录列表命令,产生一个深度缩进列表文件,这是彩色的ALA dircolors如果ls_colors设置环境变量和输出是TTY.树已经被移植和报道以下操作系统下工作: ...

  6. tree命令生成目录树

    tree命令生成目录树 1. tree背景 2. tree安装 3. tree说明 4. tree使用 1. tree背景 在项目设计文档时经常需要对项目结构进行说明,如果能生成目录树结构则是对项目结 ...

  7. linux将文件夹树状列出,Linux下用tree命令列出树形图

    命令用法: tree 参数: -a 显示所有文件和目录. -A 使用ASNI绘图字符显示树状图而非以ASCII字符组合. -C 在文件和目录清单加上色彩,便于区分各种类型. -d 显示目录名称而非内容 ...

  8. tree命令详解(输出目录树层结构,显示目录和文件)

    你也想要生成这个目录树层结构吗?显示目录和文件吗?只需要用"tree命令"即可! 效果如下: . ├── README.md ├── auto-imports.d.ts ├── c ...

  9. windows用 tree命令查看目录文件夹结构

    windows用 tree命令查看目录文件夹结构 ## 查看帮助 tree --helptree --dirsfirst --filelimit 6 -h -t –dirsfirst 目录优先展示 – ...

最新文章

  1. VMware 12.0 在安装的时候出现 microsoft runtime dll
  2. Windows下使用gvim格式化xml文件
  3. html设置返回的样式,jQuery设置或返回元素样式属性。
  4. FAILED: Error in metadata: MetaException(message:Got exception: java.net.ConnectException
  5. Android studio 运行即打包keystore之build.gradle设置
  6. 途牛java面试题_途牛java面试题.docx
  7. github上传文件 linux,第一次上传代码到github (Linux)
  8. 华为scp快充协议详解_1A1C多协议快充,倍思30W PD PPS双口充电器(BS-CH905)评测...
  9. 苹果屏幕旋转怎么设置_iPhone12屏幕供应商是谁 苹果12屏幕怎么查看是哪家
  10. 4x4矩阵键盘工作原理及扫描程序_单片机学习:单片机独立按键和矩阵键盘概念及原理...
  11. 服务机器人语音对话的实现
  12. 一款免费好用的英文润色软件(1Checker没错,这是免费的)
  13. IPhone4S自定义铃声
  14. 温湿度传感器—HDC1080
  15. 【附源码】计算机毕业设计SSM喜枫日料店自助点餐系统
  16. 转载 冯羽的程序生涯之我见
  17. 系统镜像的方法,大批量电脑重装的方法
  18. BlenderGIS 使用总结
  19. 百面机器学习(13)——生成式对抗网络
  20. 位运算与位运算的常见用法

热门文章

  1. HTTP协议是做什么的
  2. EfficientDet: Scalable and Efficient Object Detection---论文阅读(1)
  3. php生成艺术签名 下
  4. 2022年危险化学品生产单位安全生产管理人员考试试题及模拟考试
  5. (AS笔记)Android全透明沉浸式主题样式——顶部状态栏+底部导航栏
  6. 学习OpenCV(5) opencv3.4 with CUDA编译
  7. RFID无线射频技术如何做到自动巡检
  8. 蓝湖类似的软件_听说蓝湖收费了?别急,推荐几种类似产品~
  9. Python去掉Unicode编码中的‘\u‘开头
  10. 矩阵乘法(两个矩阵相乘)