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.
Join the DZone community and get the full member experience.
Join For FreeThis 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]
Published at DZone with permission of Zach Pfeffer, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments