Tree command in Linux/Ubuntu is used to list contents of directories in a tree-like format. Tree command is very good to get the complete view of all files in a directory to identify the source code structure.
When used “tree” command in a directory, it shows all the files and directory in the current directory recursively but by default it doesn’t show any hidden files.
This directory only had some files, so the tree command shown all the files in a single view. Now, lets look at some directory which had more files in it.
Using command “tree -h” we can visualise the size of each files.
Using below command “tree -h –sort=size” , we can sort the files displayed according to their size. As you can see in below image, files with maximum size are displayed on top. You can also sort the files based on the time when it was created.