Category: Ubuntu

Added: 22nd of July 2020

Viewed: 588 times

Install the tree package to list folders and files in a tree like format inside the terminal on Linux

An interesting package I stumbled across a couple of weeks back called tree enables you to list your folders and files in a tree like format, listing via the terminal. Not only that but there are many other options such as outputting the tree to an .html or .xml file.

To install tree on your ubuntu based distribution enter the following command

sudo apt-get install tree


Once installed you can take a look at the options available by enterting the following command
tree --help


For the purposes of this tutorial I created a new folder, with subfolders and documents.

To start using tree, cd to a directory of your choice
cd test-folder


And then simply enter the tree command
tree


Here is the output
Enter the tree command to display folders and files as a tree

List of options available for the tree command can be found by entering the following command.
tree --help


Since you can output the folders, sub folder, files and images as .html, I could see the tree command being helpful if I had a hard drive full of images / photographs, and wanted a way to display them through your web browser, without needing to go through the file manager.

To do this you would enter the following command. The commands creates a new file named output.html
Please note: You must specify the full path to the directory

tree -H /home/username/Desktop/test-folder > output.html


Here is what output looks like to an .html file

Output directory listing to .html directory

Other Tips & Tutorials

Ubuntu

How to find out what date you installed Linux on your machine

Posted: 13th of April 2021

Views: 283

Ubuntu

Install bashtop in Ubuntu and Ubuntu based distributions. Monitor your cpu, memory, disks, network and other processes

Posted: 21st of February 2021

Views: 363

Ubuntu

Ubuntu 20.10 Groovy Gorilla installation error, installer crashed

Posted: 3rd of February 2021

Views: 687

Ubuntu

Find out what version of Ubuntu you are running, using the terminal

Posted: 29th of January 2021

Views: 317

Ubuntu

Install Redshift to automatically adjust the colour of your screen depending on time of day on Ubuntu and Ubuntu based distributions

Posted: 26th of November 2020

Views: 726

Ubuntu

PulseAudio, Pavucontrol not saving settings after reboot on Ubuntu and Ubuntu based distributions

Posted: 11th of November 2020

Views: 2540

Ubuntu

No sound after installation of Ubuntu or Ubuntu based distribution, install pavucontrol

Posted: 9th of November 2020

Views: 397

Ubuntu

Shutdown Ubuntu and Ubuntu based distributions at a specific time or within (x) minutes

Posted: 30th of October 2020

Views: 477

Ubuntu

Open and edit files using Visual Studio Code from FIlezilla FTP Client on Linux

Posted: 27th of October 2020

Views: 5686

Ubuntu

Download Microsoft Edge preview version for Ubuntu and Ubuntu based distributions

Posted: 22nd of October 2020

Views: 486