How to get directory tree structure in your Mac terminal?

I bought my first Mac in 2013 but honestly I never used it a lot. I bought it to create a mobile app for a client and then later to watch movies and youtube videos but for the past 2 years I have been using Mac as my main computer and I am by no means an expert on using Mac but everyday I learn something good.

Today I was wondering how can I quickly view the directory structure of a folder. After doing a quick google search I found on utility called tree. Yes simple tree command that you can run on your mac but you need to install it first.

Just type the following command. I am assuming you have brew already on your mac. If not then go to https://brew.sh and download it.

  1. brew install tree

That is it really. Now go ahead and try this command.

  1. $tree
  2. ├── LICENSE
  3. ├── README
  4. ├── pom.xml
  5. └── src
  6.     ├── main
  7.     │   ├── java
  8.     │   │   └── com
  9.     │   │       └── atlassian
  10.     │   │           └── tutorial
  11.     │   │               └── myPlugin
  12.     │   │                   ├── api
  13.     │   │                   │   └── MyPluginComponent.java
  14.     │   │                   └── impl
  15.     │   │                       └── MyPluginComponentImpl.java
  16.     │   └── resources
  17.     │       ├── META-INF
  18.     │       │   └── spring
  19.     │       │       └── plugin-context.xml
  20.     │       ├── atlassian-plugin.xml
  21.     │       ├── css
  22.     │       │   └── myPlugin.css
  23.     │       ├── images
  24.     │       │   ├── pluginIcon.png
  25.     │       │   └── pluginLogo.png
  26.     │       ├── js
  27.     │       │   └── myPlugin.js
  28.     │       └── myPlugin.properties
  29.     └── test
  30.         ├── java
  31.         │   ├── it
  32.         │   │   └── com
  33.         │   │       └── atlassian
  34.         │   │           └── tutorial
  35.         │   │               └── myPlugin
  36.         │   │                   └── MyComponentWiredTest.java
  37.         │   └── ut
  38.         │       └── com
  39.         │           └── atlassian
  40.         │               └── tutorial
  41.         │                   └── myPlugin
  42.         │                       └── MyComponentUnitTest.java
  43.         └── resources
  44.             └── atlassian-plugin.xml

Cool. Isn't it?

Want to contact me?

Life begins outside your comfort zone and that is where your courage is developed". Write to me by filling this form. For living I am an Atlassian Consultant who love both Jira and Drupal. I am the author of "Mastering JIRA" and "Mastering JIRA 7" books. I Love both JIRA and Drupal (a bit more). You can Write To Me and I will get back to you as soon as I can. Have a nice day!

Social Links

Subscribe to my mailing list.

Enter your email address: