APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

2005/04/20 tree

© April 2005 Tony Lawrence

Ahh, the shell gets such disrespect nowadays. With all the GUI filesystem browsers available now, "tree" may not even be installed on your Linux box anymore. Well, you can fix that with a "yum install tree" or something like it. I couldn't get it on a recent RedHat system with "up2date" (though it's in Fedora, presently relegated to the "less popular" disk 4 on FC2).

Tree is functionally similar to "find ." or "ls -R", but with differently formatted output. It accepts many of the same arguments as "ls", and produces the expected results. It also has some of the level and device control of "find" - if you ever find yourself piping find to ls, it may be that "tree" is just what you want.

An interesting and unexpected ability is that it can produce html output with its -H flag. There's also its "-P" flag, which lets you specify wildcards:

# tree -p -P "*.html" 
|-- [drwxr-xr-x]  appl
|-- [drwxr-xr-x]  fred
|   `-- [-rw-r--r--]  a.html
`-- [drwxr-xr-x]  zoo

3 directories, 1 file

Got something to add? Send me email.

(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> tree

Inexpensive and informative Apple related e-books:

Take Control of Numbers

Take control of Apple TV, Second Edition

Digital Sharing Crash Course

Take Control of the Mac Command Line with Terminal, Second Edition

Photos for Mac: A Take Control Crash Course

More Articles by © Tony Lawrence

Printer Friendly Version

Have you tried Searching this site?

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us

Printer Friendly Version

As an experimental psychologist, I have been trained not to believe anything unless it can be demonstrated in the laboratory on rats or sophomores. (Steven Pinker)

Linux posts

Troubleshooting posts

This post tagged:


Unix/Linux Consultants

Skills Tests

Unix/Linux Book Reviews

My Unix/Linux Troubleshooting Book

This site runs on Linode