DEV Community

Muhammad Arslan Aslam
Muhammad Arslan Aslam

Posted on

Generate beautiful directory structures quickly

File Structure

Yesterday I was trying to create a file structure for one of my project's README. The one I ended up creating wasn't bad, but wasn't good enough either. So, I started looking for a tool that would help me create a beautiful directory structure quickly.

In MS Windows, tree command does it pretty well. But we don't have it in linux (or at least not in Ubuntu 18.04 at the time of writing this). But I managed to find a nifty solution to that: The Tree Command for Linux.

How to install tree?

  • Download The Tree Command for Linux from here
  • Unzip the downloaded file (unzip tree-1.8.0.tgz)
  • cd into the unzipped folder
  • Execute make and then make install

That's it. You have tree command installed and available in your terminal.

Basic Usage

Open up terminal and execute

tree /path/to/directory

For detailed documentation and help, checkout Online Man page for Tree 1.8.0

There, you have created a tree structure right in the terminal.

Select the tree structure, copy it and use it where ever you want 😊

Top comments (4)

Collapse
 
robcapell profile image
Rob Capell

What I use for this - github.com/ogham/exa (has a --tree flag).

Collapse
 
arximughal profile image
Muhammad Arslan Aslam

Look good. I'll try it.

Collapse
 
flagtick profile image
flagtick

You can take advantage of using Code Mirror (React component) and embed to Vue Component. After that implement tag

    to create folder structure and view code. Image description
Collapse
 
ibrahimyaacob92 profile image
ibrahimyaacob92

is there any online resource where we can create this