List all directories recursively in a tree format

前端 未结 5 1910
春和景丽
春和景丽 2020-12-28 09:47

I want to simulate a tree command using Shell Script that displays all the directories recursively in this format:

.
|-- Lorem
|-- Lorem
|-- Lor         


        
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-28 09:59

    You can just launch :

    tree .
    

    OR

    tree $absolute/path/of/your/dir
    

    If you want to display the hidden files.

    By default tree does not print hidden files (those beginning with a dot '.'), just type:

    tree -a .
    

    This is what tree command do.

提交回复
热议问题