{"id":730,"date":"2022-02-28T16:18:56","date_gmt":"2022-02-28T10:48:56","guid":{"rendered":"http:\/\/www.cyberaka.com\/?p=730"},"modified":"2022-02-28T16:19:03","modified_gmt":"2022-02-28T10:49:03","slug":"bash-shell-folder-as-tree","status":"publish","type":"post","link":"https:\/\/www.cyberaka.com\/?p=730","title":{"rendered":"Bash Shell &#8211; Folder as tree"},"content":{"rendered":"\n<p>I like using tree command in Linux, thankfully it has been ported to Mac as well and it is quite easy to get tree representation of files and folders inside a directory on a shell. An article on <a href=\"https:\/\/superuser.com\/questions\/359723\/mac-os-x-equivalent-of-the-ubuntu-tree-command\">StackOverFlow<\/a> talks about it aptly.  The original site is <a href=\"http:\/\/mama.indstate.edu\/users\/ice\/tree\/\">here<\/a>. <\/p>\n\n\n\n<p>In case you are using brew then it is quite easy peasy as shown below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">brew install tree<\/pre>\n\n\n\n<p>The following commands generate a tree view:<\/p>\n\n\n\n<p>Generates a tree of all files and folders in the current directory:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">tree<\/pre>\n\n\n\n<p>Generates a tree containing only folders in the current directory:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">tree -d<\/pre>\n\n\n\n<p>Generates a tree containing only folders for 3 levels depth. <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">tree -d -L 2 .<\/pre>\n\n\n\n<p>In case you want to use vanilla shell without installing anything. (doesn&#8217;t generate a tree though).<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">find . -maxdepth 3 - type d<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I like using tree command in Linux, thankfully it has been ported to Mac as well and it is quite easy to get tree representation of files and folders inside a directory on a shell. An article on StackOverFlow talks about it aptly. The original site is here. In case you are using brew then [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35,24],"tags":[],"class_list":["post-730","post","type-post","status-publish","format-standard","hentry","category-mac-os","category-tips-and-tricks"],"_links":{"self":[{"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/posts\/730","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=730"}],"version-history":[{"count":1,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/posts\/730\/revisions"}],"predecessor-version":[{"id":731,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=\/wp\/v2\/posts\/730\/revisions\/731"}],"wp:attachment":[{"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=730"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=730"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cyberaka.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=730"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}