Skip to content
Visualizing files paths as an interactive tree, works nicely with gnu linux tools such as find, ls, or git ls-files
HTML Ruby Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
exe Fixed a typo Mar 5, 2018
lib Basic implementation for bash autocompletion Mar 5, 2018
templates treemap template Feb 3, 2018
.gitignore initial version Jun 25, 2017
Gemfile rubocop corrections Jun 25, 2017
LICENSE.txt initial version Jun 25, 2017 Fixed a typo Mar 5, 2018
Rakefile initial version Jun 25, 2017
dirtree.gemspec Basic implementation for bash autocompletion Mar 5, 2018


Gem Version

Dirtree visualizes an list of file paths into a tree graph, printed as HTML page, it can be useful in visualizing a whole project you're working on to start cleanup or organizing your code or spotting large directories or unneeded files.

Tree template

Flame Graph template

Circles template

Treemap template


$ gem install dirtree


Usage: dirtree [options]... [file]...

To get autocompletion functionality
run: dirtree completion >> ~/.bashrc
Or, dirtree completion > /usr/local/etc/bash_completion.d/dirtree
    -v, --version                    Print version
    -h, --help                       Show this help text
    -l, --local-dependencies         Use saved JavaScript libraries instead of downloading them
    -s, --screenshot                 Get an image screenshot of the directory tree
    -o, --output=File.html           Specify a path to write HTML output
    -t, --template=TemplateName      Specify the template name, available templates ["tree", "circles", "flame", "treemap"]


Visualize current directory recursively

$ dirtree -o output.html **/* *

make sure you have globstar on

$ shopt -s globstar

Visualize files from git ls

$ git ls-files | dirtree -o output.html

Dirtree prints to standard output if no --output option specified so you can redirect it

$ git ls-files | dirtree > output.html

visualize only files that include specific word

$ git ls-files | grep keyword | dirtree > output.html

works with find

visualize all files that ends with rb

$ find ~ -name *rb | dirtree > output.html

With ag:silver searcher

$ ag -l | dirtree -o output.html


  • lsgh Draw a tree for a github user/org and open pull requests.


Bug reports and pull requests are welcome on GitHub at


The gem is available as open source under the terms of the MIT License.

You can’t perform that action at this time.