Graphically representing directories and filesystem as tree hierarchy is quite useful when preparing tutorials and documents. Also they are sometimes useful in writing certain monitoring scripts that helps to look at the filesystem using easy-to-read tree representations. Let's see how to do it.
tree command is the hero that helps to print graphical trees of files and directories. Usually,
tree does not come with Linux distributions. You need to install it using the package manager.
The following is a sample UNIX file system tree to show an example:
$ tree ~/unixfs unixfs/ |-- bin | |-- cat | `-- ls |-- etc | `-- passwd |-- home | |-- pactpub | | |-- automate.sh | | `-- schedule | `-- slynux ...