Linux command to print directory structure in the form of a tree.

You can use a program like tree to print a directory structure in the form of a tree. If you do not have tree installed or you want to get the similar output without tree program then you can combine find and sed commands to get tree command like output.

Example:

Install tree:

Create some files and directories:

Print directory structure in the form of a tree