tree

These tools are useful for development.

Most of the time you work on the terminal, and to find your way around a project you use things like find, ls, and tab completion.
If you need more of a bird’s eye view, you may fire up a gui browser like konqueror. But that’s a gui, and guis are for users.

Another option is tree. Here is example output of tree:

[leo@localhost devel]$ tree
.
`-- WordPress
    |-- bin
    |   `-- wppost
    |-- lib
    |   `-- WordPress
    |       |-- Base.pm
    |       `-- Post.pm
    |-- t
    |-- wp-content
    |   `-- plugins
    |       |-- akismet
    |       |   |-- akismet.gif
    |       |   `-- akismet.php
    |       |-- hello.php
    |       |-- pictpress.php
    |       |-- pm_admin_menu.php
    |       |-- postmaster
    |       |   `-- readme.txt
    |       |-- postmaster.php
    |       `-- wp-db-backup.php
    |-- wp-mail.php
    `-- xmlrpc.php

9 directories, 13 files

What if you want to do something a tiny bit more intricate?
If you are working inside a cvs tree.. things can get pretty crazy.
Here is default tree output in a cvs filesystem hierarcy slice:

[leo@localhost PDF-OCR]$ tree
|-- CVS
|   |-- Entries
|   |-- Entries.Log
|   |-- Repository
|   `-- Root
|-- INSTALL
|-- MANIFEST
|-- META.yml
|-- Makefile.PL
|-- PDF-OCR-1.02.tar.gz
|-- PDF-OCR-1.03.tar.gz
|-- PDF-OCR-1.04.tar.gz
|-- README
|-- bin
|   |-- CVS
|   |   |-- Entries
|   |   |-- Repository
|   |   `-- Root
|   |-- ocr
|   |-- pdf2ocr
|   |-- pdf2ocrturntotext
|   `-- pdfgetext
|-- lib
|   |-- CVS
|   |   |-- Entries
|   |   |-- Entries.Log
|   |   |-- Repository
|   |   `-- Root
|   |-- Image
|   |   |-- CVS
|   |   |   |-- Entries
|   |   |   |-- Entries.Log
|   |   |   |-- Repository
|   |   |   `-- Root
|   |   `-- OCR
|   |       `-- CVS
|   |           |-- Entries
|   |           |-- Repository
|   |           `-- Root
|   `-- PDF
|       |-- CVS
|       |   |-- Entries
|       |   |-- Entries.Log
|       |   |-- Repository
|       |   `-- Root
|       |-- OCR
|       |   |-- CVS
|       |   |   |-- Entries
|       |   |   |-- Entries.Log
|       |   |   |-- Repository
|       |   |   `-- Root
|       |   |-- Thorough
|       |   |   |-- CVS
|       |   |   |   |-- Entries
|       |   |   |   |-- Repository
|       |   |   |   `-- Root
|       |   |   `-- Cached.pm
|       |   `-- Thorough.pm
|       `-- OCR.pm
`-- t
    |-- 00_dependencies_check.t
    |-- 01_PDF_OCR.t
    |-- 2_PDFOCRThorough.t
    |-- 3_PDFOCRThoroughCached.t
    |-- CVS
    |   |-- Entries
    |   |-- Entries.Log
    |   |-- Repository
    |   `-- Root
    |-- dyer
    |   |-- CVS
    |   |   |-- Entries
    |   |   |-- Repository
    |   |   `-- Root
    |   |-- file1.pdf
    |   |-- file1ap.pdf
    |   |-- file2.pdf
    |   |-- file2ap.pdf
    |   |-- file3.pdf
    |   |-- file4.pdf
    |   `-- file5ap.pdf
    `-- scan1.pdf

19 directories, 63 files

Wohoa.. that’s a lot of junk to look over.. What if we just want to see the roject files, not the cvs files..
Here’s what we can do, use the parameter -I CVS, this excludes things matching a pattern match:

[leo@localhost PDF-OCR]$ tree -I CVS
|-- INSTALL
|-- MANIFEST
|-- META.yml
|-- Makefile.PL
|-- PDF-OCR-1.02.tar.gz
|-- PDF-OCR-1.03.tar.gz
|-- PDF-OCR-1.04.tar.gz
|-- README
|-- bin
|   |-- ocr
|   |-- pdf2ocr
|   |-- pdf2ocrturntotext
|   `-- pdfgetext
|-- lib
|   |-- Image
|   |   `-- OCR
|    `-- PDF
|       |-- OCR
|       |   |-- Thorough
|       |   |   `-- Cached.pm
|       |   `-- Thorough.pm
|       `-- OCR.pm
`-- t
    |-- 00_dependencies_check.t
    |-- 01_PDF_OCR.t
    |-- 2_PDFOCRThorough.t
    |-- 3_PDFOCRThoroughCached.t
    |-- dyer
    |   |-- file1.pdf
    |   |-- file1ap.pdf
    |   |-- file2.pdf
    |   |-- file2ap.pdf
    |   |-- file3.pdf
    |   |-- file4.pdf
    |   `-- file5ap.pdf
    `-- scan1.pdf

19 directories, 63 files

Pretty cool, huh?
It’s very useful to me when I’m busy on a more complex project and I need to get around, and I don’t want to use a damn gui to browse a filesystem section.

installing tree

Tree is not a standard command. You must install it with yum or build it on your machine.