Display Dir Structure in Tree Format.
box

box @box_protection

About: 204 no content in bio

Location:
Tokyo, Japan
Joined:
Aug 18, 2024

Display Dir Structure in Tree Format.

Publish Date: Dec 9 '24
1 0

Environment

  • Mac

    • CPU: Apple M4
    • OS: Sequoia 15.1.1
  • Zsh

    • Version: 5.9
  • Homebrew

    • Version: 4.4.10

Sample

Run the following command to create the sample directories and files.

mkdir -p ./dir1/dir2
touch ./file0.txt ./dir1/file1.txt ./dir1/dir2/file2.txt
Enter fullscreen mode Exit fullscreen mode

Flow

  1. Install tree command.

    brew install tree
    

    We can check the version of this command by running the following command.

    tree --version
    

    As of the time of writing, the version is 2.2.1.

  2. Run the command.

    tree
    

    The result is as follow.

    .
    ├── dir1
    │   ├── dir2
    │   │   └── file2.txt
    │   └── file1.txt
    └── file0.txt
    

Manual

Running the following command will display the manual page for the tree command in Zsh.

man tree
Enter fullscreen mode Exit fullscreen mode

After reading, press the q key to return to Zsh.

The source for tree v2.2.1 manual is here.

Comments 0 total

    Add comment