tree 指令主要的功用就是以圖形化的方式顯示硬碟或資料夾內的目錄結構,在各個系統中基本上都有這個指令,但是因為是各自的實作,所以 tree 在 linux 和 windows 中顯示的方式不同。
有些應用程式或工具可以讀取 tree 指令輸出的資料,但可能就只能 linux,不能 windows 版本的 tree,這時候就會需要使用到 Tree for Windows ,就能在 windows 上使用到 linux 的 tree 指令了!(當然使用 WSL 也是可以啦)
先開啟 Tree for Windows 的官方網站,點選 zip 下載
解壓縮後開啟指令視窗,切換到 bin 目錄下
使用方式如下:
執行畫面:
附上 windows 預設 tree 的執行畫面:
有些應用程式或工具可以讀取 tree 指令輸出的資料,但可能就只能 linux,不能 windows 版本的 tree,這時候就會需要使用到 Tree for Windows ,就能在 windows 上使用到 linux 的 tree 指令了!(當然使用 WSL 也是可以啦)
先開啟 Tree for Windows 的官方網站,點選 zip 下載
解壓縮後開啟指令視窗,切換到 bin 目錄下
tree-1.5.2.2-bin\bin\tree.exe/
|-- bin/
| `-- tree.exe
|-- contrib/
| `-- tree
| `-- tree
| `-- tree/
| `-- 1.5.2.2/
| |-- tree-1.5.2.2
| |-- tree-1.5.2.2-GnuWin32.README
| `-- tree-1.5.2.2-src/
| |-- CHANGES
| |-- INSTALL
| |-- LICENSE
| `-- README
|-- man/
| `-- cat1/
| `-- tree.1.txt
`-- manifest/
|-- tree-1.5.2.2-bin.mft
`-- tree-1.5.2.2-bin.ver
使用方式如下:
tree.exe 要顯示的目錄
執行畫面:
附上 windows 預設 tree 的執行畫面:
參數
排除資料夾
排除 node_modules 和 dist 資料夾
tree -I 'node_modules|dist'
深度
只顯示當前資料夾,不會顯示子目錄內的檔案
tree -L 1
留言
張貼留言
如果有任何問題、建議、想說的話或文章題目推薦,都歡迎留言或來信: a@ruyut.com