DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • TOP-5 Lightweight Linux Distributions for Container Base Images
  • Stop Fine-Tuning for Everything: A Decision Tree for RAG vs Tuning vs Tools
  • The Self-Healing Directory: Architecting AI-Driven Security for Active Directory
  • Recent Linux Kernel Features Relevant to System Design

Trending

  • A Deep Dive into Tracing Agentic Workflows (Part 1)
  • How SaaS Architectures Break at Scale — and the Engineering Decisions That Prevent It
  • Optimizing High-Volume REST APIs Using Redis Caching and Spring Boot (With Load Testing Code)
  • AI Agents in Java: Architecting Intelligent Health Data Systems
  1. DZone
  2. Software Design and Architecture
  3. Performance
  4. Create a Tree-View of a Directory on Linux With 'Tree'

Create a Tree-View of a Directory on Linux With 'Tree'

Here's a short tutorial on how you can create a tree-view of a directory on Linux.

By 
Zach Pfeffer user avatar
Zach Pfeffer
·
Aug. 21, 19 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
3.8K Views

Join the DZone community and get the full member experience.

Join For Free

This post shows you how to create a tree-view of a directory on Linux (Ubuntu).

Install and Use Tree

To create a tree view of a directory, install tree by running sudo apt install tree.

Type tree in the directory you'd like to list:

Type tree -d  to just get directories:

Create This Directory

The demo tree structure was created using these commands:

mkdir ~/treedemo
cd ~/treedemo/
mkdir dir1
mkdir dir2
mkdir dir3
cd dir1
touch file1.txt
touch file2.txt
touch file3.txt
cd ../dir2
touch file4.txt


Type rm -rf ~/treedemo  to remove the treedemo directory.

Reference

GNU image from [link]

Directory Tree (data structure) Linux (operating system)

Published at DZone with permission of Zach Pfeffer. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • TOP-5 Lightweight Linux Distributions for Container Base Images
  • Stop Fine-Tuning for Everything: A Decision Tree for RAG vs Tuning vs Tools
  • The Self-Healing Directory: Architecting AI-Driven Security for Active Directory
  • Recent Linux Kernel Features Relevant to System Design

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook