First of all this is not my code, I found it on this page via Google, while looking for something that would work like the 'tree' command in Windows.
This guy found a way to do so, using just ls, grep and sed; pretty neat! Here's the command:
ls -R | grep ":" | sed -e 's/://' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'$ tree /Applications | more
/Applications
|-Address Book.app
|---Contents
|-----MacOS
|-----Resources
|-------ABLargeTypeWindow.nib
etc...
You may wish to add | more at the end to page through the output. Or try using > ~/Desktop/mytree.txt at the end to dump the output to a file. I do not, however, recommend doing that with a huge directory such as Applications, unless you have some time to wait. I tried it, and after a few minutes of waiting, wound up with a 1.1mb text file containing 37,000+ rows!]
Mac OS X Hints
http://hints.macworld.com/article.php?story=20060209130749352