Blog → Post


(TIP) Replacing Familiar Tools: tree
...tips to ease the move to Linux
by @News, march 25, 2019, 02:09am utc

If you are used to the Windows (DOS) tree command as a way to getting a complete, opened, list of folders and the folders & files they contain -- then good news.

tree exists on Linux as well.

$ tree

Tree Listing

As always, try --help to see the various parameters available for tree.

$ tree --help

Just a few examples are:

-q Print non-printable characters as '?'.
-N Print non-printable characters as is.
-Q Quote filenames with double quotes.
-p Print the protections for each file.
-u Displays file owner or UID number.
-g Displays file group owner or GID number.
-s Print the size in bytes of each file.
-h Print the size in a more human readable way

The last one there, -h, is pretty interesting as it includes a concise size of the file or folder on each line.

$ tree -h

Item Size

In just a bit of info to store for later ... tree also has a -X parameter, which returns an XML representation of your files. This XML list can then be pulled into other applications or reports.

$ tree doc -X

XML Tree


tags: Beginning users, Tips
Footer done in Inkscape