tree
tree: list directories as a tree.
Synopsis
tree [-a] [-d] [-L level] [–noreport] [dir…]
Description
tree prints each dir (the working directory when none is named), then its contents as a tree, drawn with lines, descending into every directory. A symbolic link is shown as name -> target and is not followed. Names starting with a dot are left out.
At the end it reports how many directories and files it showed, for all the dirs together.
Options
- -a
- Shows names starting with a dot too.
- -d
- Shows directories only; the report then counts only directories.
- -L level
- Descends at most level levels (1: only the directory’s own entries). It must be greater than 0.
- –noreport
- Leaves the report out.
-a and -d can be joined (-ad).
Exit status
0 on success; 1 for an invalid option or level; 2 if a dir isn’t a directory (it is shown as dir [error opening dir] and the others are still listed).
Examples
tree
tree -L 1 /
tree -d /lib
See also
ls(1), find(1), du(1)