tree is a command-line program that shows the contents of a directory recursively complete with colors and nesting structure.
tree is not installed by default in Linux Mint 17.1, so install it with Synaptic or at the command line:
sudo apt-get install tree
To run, enter tree at the command prompt and watch the directory structure fly by.
By default, tree shows the contents of the current directory recursively. We can view from a specific directory by entering it as an argument.
Show contents of /bin.
Show the entire file system.
To save the contents to a file, redirect to a text file.
tree / > big-file-list.txt
(This can produce a file too large for gedit to process! Gedit kept crashing when I tried to open it, but Kate worked.)
Viewing man tree reveals a wealth of options. For example, to view file sizes with each file, use the -h (human-readable) option.
tree / -h
How about the full path too?
tree / -hf
Why not limit to three levels deep (-L 3) and save to a file?
tree -hfL 3 > big_file_list.txt
Be sure to place a space between the L and the 3. L3 will not work.
Show directories only with the -d option.
tree / -hdfL 1
tree / -hdfL 2
Keep in mind that some directory contents will not be listed if you do not have permissions to read them. /root is one example.
The possibilities are many, so experiment and have fun!