Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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, 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
up vote 12 down vote accepted

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

share|improve this answer

The GnuWin32 build of tree is at - 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
IMO, this is the most straight forward way to get tree cmd in Cygwin and I tried the compilation route before unsuccessfully. With this you just download the binary, extract it to a folder on your cygwins path and violla, tree command out of the box – Nik Apr 11 at 18:53

git-bash is really just a cut down version of mingw. Install Cygwin from, 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

You must install the Three for Windows as said above by the link:

Besides that you need to add the tree program to your windows path or the tree command will be available only on cmd. Access your windows path and add this (for default installation):

;C:\Program Files (x86)\GnuWin32\bin

Them you will be able to use tree command on git bash on windows.

share|improve this answer

This is the beginning of my .gitconfig file : I made an alias for log --graph

# This is Git's per-user configuration file.
# Please adapt and uncomment the following lines:
    name = xxxxxx
    email = 
    tree = log --graph --oneline --all --pretty=format:'%C(yellow)%h%Creset -%Cred%d%Creset %s %Cgreen%cr%Creset %C(cyan)%an%Creset %gn'
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .