【mac配置】macOS下使用tree命令生成目錄樹結構

mac下使用tree命令生成目錄樹結構html

1.安裝tree命令

這裏是經過Homebrew進行安裝的,Homebrew是一款macOS平臺下的軟件包管理工具,擁有安裝、卸載、更新、查看、搜索等不少實用的功能;下載地址https://brew.sh/index_zh-cn.htmlvue

mac安裝tree brew install treenode

2.tree經常使用命令

在終端直接執行tree命令,展現當前文件夾下全部的目錄樹結構(包含文件和文件夾以及子文件夾)web

  • 查看幫助 tree --help
  • 指定層級 tree -L 2
  • 顯示目錄名稱而非內容 tree -d "src"
  • 不顯示符合範本樣式的文件或目錄名稱 tree -I "node_modules"
  • 不顯示符合範本樣式的文件或目錄名稱 tree -I "node_modules|tests"
  • 寫入指定文件,若是文件不存在自動建立,若是存在則覆蓋內容 tree -I "node_modules|test*|LICENSE|README.en.md" -L 2 > README.md

3.經常使用命令組合

$ tree -I "node_modules|test*|LICENSE|README.en.md" -L 2

.
├── README.md
├── babel.config.js
├── jest.config.js
├── package.json
├── packages
├── public
│   ├── favicon.ico
│   └── index.html
├── src
│   ├── index.ts
│   └── theme
├── tsconfig.json
├── vue.config.js
├── website
│   ├── App.vue
│   ├── assets
│   ├── components
│   ├── docs
│   ├── main.ts
│   ├── router
│   ├── shims-tsx.d.ts
│   ├── shims-vue.d.ts
│   └── views
└── yarn.lock
相關文章
相關標籤/搜索