# Add this to your .bashrc or .zshrc or wherever # Copyright (C) 2012 by Adam Katz , GPLv3+ # see also http://www.commandlinefu.com/commands/view/10592/ function tree() { local dirs_only='' case $1 in -d ) dirs_only="-type d"; shift ;; -?* ) [ ! -r "$1" ] && echo "Usage: tree [-d] [PATH...]" && return 1 ;; esac find "${@:-.}" $dirs_only |sed 's:[^-][^/]*/:--:g; s/^-/ |/' }