tldr/pages.zh/common/tree.md

33 lines
831 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# tree
> 以树的形式显示当前目录的内容。
> 更多信息:<http://mama.indstate.edu/users/ice/tree/>.
- 显示深度达到 “级数” 级的文件和目录(其中 1 表示当前目录):
`tree -L {{级数}}`
- 只显示目录:
`tree -d`
- 同时显示隐藏文件:
`tree -a`
- 打印没有缩进行的树,显示完整路径(使用`-N`不转义空格和特殊字符):
`tree -i -f`
- 以可读格式打印每个文件节点的大小,目录显示其累积大小(类似在`du`命令中所示):
`tree -s -h --du`
- 使用通配符glob模式在树层次结构中查找文件并删除不包含匹配文件的目录
`tree -P '{{*.txt}}' --prune`
- 在树层次结构中查找目录,删除不属于所需目录的目录:
`tree -P {{文件夹名}} --matchdirs --prune`