Linux命令--tree

tree

  • tree -C :颜色显示

  • tree -f : 显示文件全路径

  • tree -L 2 :只显示2层

  • tree -P *.pl :只显示文件目录和*.pl的perl文件。

  • tree -F :显示目录后面的;显示可执行文件*;功能类似ls -F

  • tree -I :忽略某个目录或者文件内容,支持正则

    tree -I "node_modules"
    tree -I "node_modules|cache|test_*"
    
  • tree –help :帮助手册

最常用

# tree -I "venv|__pycache*|*.pyc" -FCL 3
.
├── app/
│   ├── __init__.py
│   ├── routes.py
│   └── templates/
│       ├── base.html
│       └── index.html
├── config.py
└── microblog.py

带颜色显示2级目录

# tree -FCL 2

排除显示某个目录

# tree -I "venv" -FCL 2

原文地址:https://www.cnblogs.com/xuwei1/p/10006604.html