Seeing the forest with tree

Lead Image © amplion,

In Full View

The tree command can provide a clear view of all your files and directories, and offers a few advantages over the usual ls.

The tree command [1] is a tool that I'd overlooked until recently. After trying it for several weeks, however, I am starting to prefer its tree-like display of directories and files to the plain lists generated by ls.

Part of the reason is that, in these GUI-oriented days, even a directory tree made with ASCII characters is more comfortable than no structural display at all. The functional differences between tree and ls are minimal. The two commands share a few options, such as -a for displaying all files, and even when the options are different, the functionality remains similar. The largest exception I have noticed is that ls offers an option for the number of columns in which to display results; the tree display makes a single column unavoidable.

You have to look closely to see the differences, but tree is consistently more versatile, starting with, unlike ls, recursion. By default, tree displays all files in all subdirectories.


Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content