常用 shell 命令总结—tree

735 阅读1分钟

常用 shell 命令总结—tree

一、 什么是 tree 命令?

tree 命令一个 shell 命令,Mac 平台下通过brew install tree安装。安装之后可以在终端 iTerm2

中展示出漂亮简洁的目录结构,便于演示和分享。

二、 如何使用

一般使用方法:tree [参数]

示例如下:

$ tree

$ tree src

# 一级目录,排除node_moduels
$ tree . -L 1 -I node_modules

常用的参数如下:

参数名说明
-L level显示目录层级
-C显示颜色
-d只显示目录
-f显示 full path
-ssize 显示体积大小
-I排除目录

更加详细的文档可以使用man tree进行查阅。