Account
Categories

tree command


Definition:

When you want to view a file or folder inside another folder in a clear tree-like structure, use the tree command.


Syntax:

tree [options] [directory]

Example:

tree project

Output:

project
├── notes.txt
├── script.sh
└── subfolder
    └── file1.txt
    

Explanation:

  • Project → This is the main folder.
  • notes.txt and script.sh → These files are inside the project folder.
  • Subfolder → This is a subfolder placed inside the main project folder.
  • file1.txt → This file is inside the subfolder.