Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm using git-bash on Windows 7. I'd like to see a tree of the current directory. However:

jcollum@DEVELOPER01 ~/Dev/express_coffee            
$ tree .                                            
sh.exe": tree: command not found

OK, so I don't have the tree command. How do I install it? I found an article but it was for Macs.

share|improve this question
git-bash is really just a cut down version of Cygwin. Best way to go is install Cygwin from cygwin.com, and use the package manager there to install tree or whatever package it's in (if it exists). –  allquixotic Jan 14 '13 at 16:35
@allquixotic actually these days it's mingw –  jcollum Jan 14 '13 at 16:47

3 Answers 3

up vote 7 down vote accepted

You could also use "cmd //c tree" to use Windows' tree

share|improve this answer

git-bash is really just a cut down version of mingw. Install Cygwin from cygwin.com, and then either use the package manager to install 'tree' or whatever package it's in, or if it doesn't exist, then install gcc, download the tree source from here:


Then follow the instructions in the INSTALL file (make, make install)

share|improve this answer
So is it impossible in minggw? –  Jen S. Jan 21 '14 at 9:27
I'd imagine it isn't too hard from mingw, but isn't possible from your default git-bash prompt, because I imagine that git-bash doesn't come with tools you need like a C/C++ compiler. But you could try installing mingw, making sure to include gcc, and following the instructions in the tree INSTALL file. I have used mingw to compile things like this on Windows in the past, so this part is definitely possible. –  Jonathan Hartley Jan 22 '14 at 9:30

The GnuWin32 build of tree is at http://gnuwin32.sourceforge.net/packages/tree.htm - you'd need to add it to your path manually if you're not already using GnuWin32.

If you want to use it at a Windows console also you'd need to rename or copy tree.exe to something else, e.g. lstree.exe, otherwise the build-in tree command will take precedence. The advantage of the GnuWin version is that it has lots of options - e.g. tree -L 2 would limit the recursion depth to 2.

-a            All files are listed.
-d            List directories only.
-l            Follow symbolic links like directories.
-f            Print the full path prefix for each file.
-i            Don't print indentation lines.
-q            Print non-printable characters as '?'.
-N            Print non-printable characters as is.
-p            Print the protections for each file.
-u            Displays file owner or UID number.
-g            Displays file group owner or GID number.
-s            Print the size in bytes of each file.
-h            Print the size in a more human readable way.
-D            Print the date of last modification.
-F            Appends '/', '=', '*', or '|' as per ls -F.
-v            Sort files alphanumerically by version.
-r            Sort files in reverse alphanumeric order.
-t            Sort files by last modification time.
-x            Stay on current filesystem only.
-L level      Descend only level directories deep.
-A            Print ANSI lines graphic indentation lines.
-S            Print with ASCII graphics indentation lines.
-n            Turn colorization off always (-C overrides).
-C            Turn colorization on always.
-P pattern    List only those files that match the pattern given.
-I pattern    Do not list files that match the given pattern.
-H baseHREF   Prints out HTML format with baseHREF as top directory.
-T string     Replace the default HTML title and H1 header with string.
-R            Rerun tree when max dir level reached.
-o file       Output to file instead of stdout.
--inodes      Print inode number of each file.
--device      Print device ID number to which each file belongs.
--noreport    Turn off file/directory count at end of tree listing.
--nolinks     Turn off hyperlinks in HTML output.
--dirsfirst   List directories before files.
--charset X   Use charset X for HTML and indentation line output.
--filelimit # Do not descend dirs with more than # files in them.

Compared to the built-in tree:

/F   Display the names of the files in each folder.
/A   Use ASCII instead of extended characters.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.