概览

  • tree 安装
  • tree 可选参数
  • tree 常用参数
  • win 配置

tree 安装

#Debian
apt-get install tree#Ubuntu
apt-get install tree#Alpine
apk add tree#Arch Linux
pacman -S tree#Kali Linux
apt-get install tree#CentOS
yum install tree#Fedora
dnf install tree#OS X
brew install tree#Raspbian
apt-get install tree#Docker
docker run cmd.cat/tree tree

这里以 CentOS 为例:yum install tree


可选参数

  • Syntax
usage: tree [-acdfghilnpqrstuvxACDFQNSUX] [-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>] [<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.
--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.
--du          Print directory sizes.
--prune       Prune empty directories from the output.-------- 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.
-r            Sort files in reverse alphanumeric order.
-t            Sort files by last modification time.
-c            Sort files by last status change time.
-U            Leave files unsorted.
--dirsfirst   List directories before files (-U disables).------- Graphics options ------
-i            Don't print indentation lines.
-A            Print ANSI lines graphic indentation lines.
-S            Print with ASCII graphics indentation lines.
-n            Turn colorization off always (-C overrides).
-C            Turn colorization on always.------- XML/HTML options -------
-X            Prints out an XML 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.
---- Miscellaneous options ----
--version     Print version and exit.
--help        Print usage and this help message and exit.

常用参数

  • tree -L <num>:显示 num 级深度的文件和目录
  • tree -d:显示目录
  • tree -a:显示所有(含隐藏)文件
  • tree -h/s:显示节点大小
  • tree -P/I '<Pattern>':Pattern 取正/反
  • ※ 组合使用
    • e.g. tree -a -d -h -P 'dist'


显示 num 级深度的文件和目录(其中 1 表示当前目录)

※ 注意是「文件 & 目录」

  • tree -L <num>

显示目录

  • tree -d

显示所有(含隐藏)文件

  • tree -a

显示节点大小

  • tree -h
  • tree -s

匹配字符 Pattern

  • tree -P '<pattern>':展示符合匹配规则的 Files

  • tree -I '<pattern>':展示符合匹配规则 以外 的 Files(简言:取反)

    • 这里以不想列出 *.json*.css 为例:tree -I '*.json|*.css'


win 配置

基于 node 的 treer

  • 安装:npm install -g treer
  • 使用:treer - h

基于 tree-node-cli

  • 安装:npm install -g tree-node-cli
  • 使用:tree - h

参考文章

  • tree 命令详解
  • 使用 tree 生成目录树结构

Linux - tree 生成目录树「Note」相关推荐

  1. tree命令生成目录树

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

  2. Windows-tree命令生成目录树

    tree命令生成目录树 2K以上的操作系统中都带有tree命令,98下面没有,就算是把2K下面的拷过去也用不起来. tree命令的格式是tree [drive][path] [/F] [/A] /F ...

  3. Linux系统的目录树

    更多详细内容,见Linux目录树详解(转)_peniel_shen的博客-CSDN博客 Linux系统的目录树: root@ubuntu:/# tree -L 1 . ├── bin //保存系统自身 ...

  4. SAP GUI 账户密码重置「Note」

    SAP GUI 账户密码重置「Note」 概览 SAP_ALL 权限用户登录系统 SU01 解锁 SU01 生成口令 重置密码 SU01 解锁 首先使用拥有 SAP_ALL 权限的用户登录系统 如果你 ...

  5. Python生成目录树

    1.CMD生成目录树 1.1 查看帮助 1.2 作用 1.3 命令格式 2.Python生成目录树 2.1 标准库pathlib介绍 2.2 代码实现 2.3 改进,显示指定目录 2.4 改进,保存文 ...

  6. python学习 生成目录树

    第一种最速方式,cmd直接用tree命令,如果还要文件用 tree /f C:\Users\ds>tree d:\9月考勤 > d:\test.xlsC:\Users\ds>tree ...

  7. Linux下的目录树

    Linux下的目录树   /   这就是根目录.在Windows,DOS或者其他类似的操作系统里面,每个分区都会有一个相应的根目录.但是Linux和其他Unix系统把所有的文件都放在一个目录树里面,/ ...

  8. oracle 生成目录树,根据路径列和标题列生成目录树 - Foxtable 中文帮助文档

    根据路径列和标题列生成目录树 有的时候,目录树要根据两列内容生成,一列指定路径,一列指定标题,根据两列内容生成目录树需要使用GenerateTree方法. 语法: GenerateTree(DataT ...

  9. UiPath 修改默认浏览器配置「Note」

    UiPath 修改默认浏览器配置「Note」 配置如图所示:

最新文章

  1. Nature子刊:三代测序重构菌株水平宏基因组序列的计算框架iGDA
  2. R构建指数回归模型(Exponential Regression)
  3. STM32-超级终端显示日历
  4. ClickHouse系列教程二:使用航班飞行数据
  5. 分布式缓存的面试题3
  6. 电脑解锁后黑屏有鼠标_笔记本电脑开机黑屏只显示鼠标怎么办?
  7. 2020中国十大最丑建筑出炉,你觉得哪个更丑?
  8. C# SFTP上传文件
  9. 十年前乔布斯曾试图颠覆电视行业 如今苹果终于出手了
  10. 解决XP IIS(HTTP 500内部服务器错误)
  11. 倒立摆入门详解+pid调参
  12. Adaboost Random Forests 等机器学习方法 搜索热度
  13. 抢红包: 红包过期失效案例
  14. 重塑规则 定义未来 三星Galaxy S22系列中国发布
  15. RealView编译器常用特有功能
  16. Jedis的基本使用
  17. 移动端测试——移动端基础
  18. m35c android 4.4,索尼M35c电信版评测:Android 4.1系统和娱乐体验
  19. 2021年山东省安全员C证考试资料及山东省安全员C证找解析
  20. 使用RANSAC的鲁棒TDOA Chan定位算法

热门文章

  1. Docker解读(什么是容器)
  2. 高新技术企业认定申请通过后补贴
  3. SQL经典案例(学生表,课程表,选课表,教师表) 练习
  4. linux硬盘对拷 ghost,100%完美保留数据 Ghost硬盘对拷_硬盘_内存硬盘技巧-中关村在线...
  5. java 双声道音频_一种多声道录音的实现方法(语音识别功能)
  6. file:///Users/xmg/Desktop/xiangmu~Bsbdejie/BaisibudejieTheSecondtime/BaisibudejieTheSecond/Baisib...
  7. linux系统中对日志的管理
  8. Linux下对文件权限的管理
  9. 谷歌浏览器禁止打开某些网站
  10. 使用word2vec对新浪微博进行情感分析