I would like to download and install (compile) gnu tree on linux machine with no root access, but Googling GNU tree doesn't even give me a page where to download it to. Anyone?

  • No root access: just export an user directory such as ~/.local/bin, etc to PATH, then similarly ~/.local/lib to LIBRARY_PATH and LD_LIBRARY_PATH and then use GNU stow to manage your locally built packages. Done.
    – dmvianna
    Feb 10, 2016 at 5:43

1 Answer 1


Here is the official website and the latest sources: http://mama.indstate.edu/users/ice/tree/

Rather than compiling tree you may want to have a look at this one-liner in shellscript:

ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/' 

Not as clean as tree but good enough for the majority of cases !

For another implementation of tree in bash the guy made a good script here: http://mama.indstate.edu/users/ice/bash/btree

  • The problems with such one-liners are, as you have noted yourself, that 1) they are not as clean as tree and 2) they are only "good enough" for the "majority".
    – user1686
    Feb 15, 2012 at 10:36
  • 1
    A machine without root access is "good enough" too for the majority, we are not talking about an edge case here but a specific one. Moreover when you are down to compiling your tools on a machine you're not root on you may be interested in quicker solution as a bash script ; installing a compiler and resolving dependencies isn't that fun just to display a tree representation of some folders.
    – Shadok
    Feb 15, 2012 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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