Generally, the tree command doesn't come preinstalled. So, you will have to install the package that contains the command. To install on an Ubuntu/Debian-based system, run the following command:
sudo apt-get install tree
To install on Linux, which supports the yum package manager, run the following command:
yum install tree
To verify your installation, just run the tree command, and you should be able to see the current directory structure printed. For me, it's something like this:
There are multiple options supported by the tree command. It's for you to explore.