bash下生成目录树

经常看到github上有项目会在readme中显示项目的目录结构,一个清晰的目录结构有利于其他人快速的了解整个项目的功能和架构。
那么如何生成一个简洁明了的目录树呢?有一个小应用tree可以做到。直接通过apt installbrew install等方式安装即可。
一个示例:

.
├── LICENSE
├── README.md
├── manage.py
├── project
│   ├── __init__.py
│   ├── __pycache__
│   │   └── __init__.cpython-36.pyc
│   ├── server
│   │   ├── __init__.py
│   │   ├── __pycache__
│   │   │   ├── __init__.cpython-36.pyc
│   │   │   ├── config.cpython-36.pyc
│   │   │   └── models.cpython-36.pyc
│   │   ├── config.py
│   │   └── models.py
│   └── tests
│       ├── __init__.py
│       ├── __pycache__
│       │   └── test__config.cpython-36.pyc
│       ├── base.py
│       ├── helpers.py
│       └── test__config.py
└── requirements.txt

6 directories, 17 files

tree命令的参数有很多,比较常用有
-t 按修改时间排序
-L 指定显示的层级

你可能感兴趣的:(bash下生成目录树)