tree

The tree utility outputs a full listing of everything in your current directory, and those below.

  • Just directories: tree -d
  • Output colour to less: tree -C --info | less -re
  • Ignore files in the .gitignore file: tree --gitignore

You can place information about the files in a directory to use with the tree --info option, like this:

1config
2	Config files.
3	This is a git submodule.
4README.md
5	Summary of the git.
6*.jpg
7	Little picture, does not display
8	words well.

Each description-line starts with a tab.

Markdown Conversion

To represent a file structure as a nested series of markdown lists, you can try this horrifying sed one-liner:

1tree -tf --dirsfirst --gitignore --noreport --charset ascii  | \
2    sed -e 's/| \+/  /g' \
3    -e 's/[|`]-\+/ */g' \
4    -e 's:\(* \)\(\(.*/\)\([^/]\+\)\):\1[\4](\2):g'