2014-04-14 21:56:07 +04:00
|
|
|
# tree
|
|
|
|
|
|
|
|
> Show the contents of the current directory as a tree.
|
|
|
|
|
2016-08-03 14:08:25 +03:00
|
|
|
- Show files and directories up to 'num' levels of depth (where 1 means the current directory):
|
2014-04-14 21:56:07 +04:00
|
|
|
|
|
|
|
`tree -L {{num}}`
|
|
|
|
|
2016-01-07 20:31:27 +03:00
|
|
|
- Show directories only:
|
2014-04-14 21:56:07 +04:00
|
|
|
|
|
|
|
`tree -d`
|
|
|
|
|
2016-01-07 20:31:27 +03:00
|
|
|
- Show hidden files too:
|
2014-04-14 21:56:07 +04:00
|
|
|
|
|
|
|
`tree -a`
|
|
|
|
|
2016-09-16 13:40:15 +03:00
|
|
|
- Print the tree without indentation lines, showing the full path instead (use `-N` to not escape whitespace and special characters):
|
2014-04-14 21:56:07 +04:00
|
|
|
|
2016-08-03 14:05:22 +03:00
|
|
|
`tree -i -f`
|
2015-12-29 07:13:19 +03:00
|
|
|
|
2019-02-11 21:00:49 +03:00
|
|
|
- Print the size of each node next to it, in human-readable format, with directories displaying their cumulative size (as in the `du` command):
|
2015-12-29 07:13:19 +03:00
|
|
|
|
2016-08-03 14:05:22 +03:00
|
|
|
`tree -s -h --du`
|
2015-12-29 07:13:19 +03:00
|
|
|
|
2016-08-24 19:09:58 +03:00
|
|
|
- Find files within the tree hierarchy, using a wildcard (glob) pattern, and pruning out directories that don't contain matching files:
|
2015-12-29 07:13:19 +03:00
|
|
|
|
2016-10-13 18:25:23 +03:00
|
|
|
`tree -P '{{*.txt}}' --prune`
|
2016-08-24 19:09:58 +03:00
|
|
|
|
|
|
|
- Find directories within the tree hierarchy, pruning out directories that aren't ancestors of the wanted one:
|
|
|
|
|
|
|
|
`tree -P {{directory_name}} --matchdirs --prune`
|