The following is a sample Unix filesystem tree to show an example:
$ tree ~/unixfs
unixfs/
|-- bin
| |-- cat
| `-- ls
|-- etc
| `-- passwd
|-- home
| |-- pactpub
| | |-- automate.sh
| | `-- schedule
| `-- slynux
|-- opt
|-- tmp
`-- usr
8 directories, 5 files
The tree command supports several options:
- To display only files that match a pattern, use the -P option:
$ tree path -P PATTERN # Pattern should be wildcard in single
quotes
Consider this example:
$ tree PATH -P '*.sh' # Replace PATH with a directory path
|-- home
| |-- packtpub
| | `-- automate.sh
- To display only files that do not match a pattern, use the -I option:
$ tree path -I PATTERN
- To print the size along with files and directories, use the -h option:
$ tree -h