2014-04-14 18:56:07 +01:00
|
|
|
# tree
|
|
|
|
|
|
|
|
> Show the contents of the current directory as a tree.
|
2020-09-17 12:49:09 +01:00
|
|
|
> More information: <http://mama.indstate.edu/users/ice/tree/>.
|
2014-04-14 18:56:07 +01:00
|
|
|
|
2020-02-08 23:08:19 +00:00
|
|
|
- Print files and directories up to 'num' levels of depth (where 1 means the current directory):
|
2014-04-14 18:56:07 +01:00
|
|
|
|
|
|
|
`tree -L {{num}}`
|
|
|
|
|
2020-02-08 23:08:19 +00:00
|
|
|
- Print directories only:
|
2014-04-14 18:56:07 +01:00
|
|
|
|
|
|
|
`tree -d`
|
|
|
|
|
2020-09-17 12:49:09 +01:00
|
|
|
- Print hidden files too with colorization on:
|
2014-04-14 18:56:07 +01:00
|
|
|
|
2020-09-17 12:49:09 +01:00
|
|
|
`tree -a -C`
|
2014-04-14 18:56:07 +01:00
|
|
|
|
2020-10-25 16:55:22 +00:00
|
|
|
- Print the tree without indentation lines, showing the full path instead (use `-N` to not escape non-printable characters):
|
2014-04-14 18:56:07 +01:00
|
|
|
|
2016-08-03 12:05:22 +01:00
|
|
|
`tree -i -f`
|
2015-12-29 04:13:19 +00:00
|
|
|
|
2020-09-17 12:49:09 +01:00
|
|
|
- Print the size of each file and the cumulative size of each directory, in human-readable format:
|
2015-12-29 04:13:19 +00:00
|
|
|
|
2020-09-17 12:49:09 +01:00
|
|
|
`tree -s -h --du`
|
2015-12-29 04:13:19 +00:00
|
|
|
|
2020-09-17 12:49:09 +01:00
|
|
|
- Print files within the tree hierarchy, using a wildcard (glob) pattern, and pruning out directories that don't contain matching files:
|
2015-12-29 04:13:19 +00:00
|
|
|
|
2020-09-17 12:49:09 +01:00
|
|
|
`tree -P '{{*.txt}}' --prune`
|
2017-12-28 05:34:17 +00:00
|
|
|
|
2020-09-17 12:49:09 +01:00
|
|
|
- Print directories within the tree hierarchy, using the wildcard (glob) pattern, and pruning out directories that aren't ancestors of the wanted one:
|
2017-12-28 05:34:17 +00:00
|
|
|
|
2020-09-17 12:49:09 +01:00
|
|
|
`tree -P {{directory_name}} --matchdirs --prune`
|
2020-02-08 23:08:19 +00:00
|
|
|
|
|
|
|
- Print the tree ignoring the given directories:
|
|
|
|
|
|
|
|
`tree -I '{{directory_name1|directory_name2}}'`
|