Bash Listing Files List Files in a Tree-Like Format


Example

The tree command lists the contents of a specified directory in a tree-like format. If no directory is specified then, by default, the contents of the current directory are listed.

Example Output:

$ tree /tmp
/tmp
├── 5037
├── adb.log
└── evince-20965
    └── image.FPWTJY.png

Use the tree command's -L option to limit the display depth and the -d option to only list directories.

Example Output:

$ tree -L 1 -d /tmp
/tmp
└── evince-20965