2-Minute Coffee Tip #3: How to Visualize Directory Structures Using the tree command

I'm a data analyst with development and graphic design experience. I know how to build a website from scratch, but I sometimes work with entrepreneurs and small businesses with their Wix or Squarespace sites, so basically I help them to establish their online presence. When I'm not doing that, I'm studying and blogging about data engineering, data science or web development.
I found a great command line tool called Tree that shows the contents of a current directory in a tree-like format in plain text. It's perfect for displaying a project's directory structure in a Markdown file.
The reason I need this is because I have to create a Claude.md file and I need to tell it how I have my project set up, as I plan to have it create documentation and a user guide for the features in my micro SaaS. As much as I “love” writing documentation, this is something I will gladly pass to AI to do for me.
First you need to download, Tree.
I have a Mac so I just have Homebrew handle it all for me, simply run brew install tree in Terminal to install it (if you have a Linux machine, you too can also use Homebrew).
And once it is done brewing installing, I just use the command tree inside the directory you want to see the directory structure tree:
>> tree
.
├── assets
│ ├── Feature_1.png
│ ├── Feature_2.png
│ ├── Feature_3.png
│ ├── PinkPhi_Logo_hero.png
│ └── product.png
├── home_page.py
├── main.py
├── pages
├── pyproject.toml
├── README.md
├── src
│ ├── pinkphi
│ │ └── test_pkg
│ │ └── complex_math.py
│ └── pinkphi.egg-info
│ ├── dependency_links.txt
│ ├── PKG-INFO
│ ├── requires.txt
│ ├── SOURCES.txt
│ └── top_level.txt
├── styles
│ └── main.css
├── tests
│ └── test_simple.py
└── uv.lock
Running man tree will display all the details about this tool, including all of the different flags you can pass to it to adjust the output.
For example, tree -L 2 -d will only display the top two levels of the current directory, and only includes directories:
>> tree -L 2 -d
.
├── assets
├── pages
├── src
│ ├── pinkphi
│ └── pinkphi.egg-info
├── styles
└── tests
A reflective sip of coffee has never tasted so satisfying. 😌☕️




