tree is a recursive directory displaying command that helps to see the in depth indented listing of directories and files.
How to install tree command on macOS Terminal?
You can make use of Home-brew to install the tree package,
- Open Terminal,
- Type command: brew install tree
code2care@mac Desktop % brew install tree
==> Downloading https://homebrew.bintray.com/bottles/tree-1.8.0.arm64_big_sur.bottle.tar.gz
Already downloaded: /Users/code2care/Library/Caches/Homebrew/downloads/ e446cb0fe0006900ce03f20b28170d16fc298e8ffad73a071f4d603df97ecb58 --tree-1.8.0.arm64_big_sur.bottle.tar.gz
==> Pouring tree-1.8.0.arm64_big_sur.bottle.tar.gz
🍺 /opt/homebrew/Cellar/tree/1.8.0: 8 files, 158.5KB
How to use tree command?
Just be in the dir where you want to see the structure of files and folders and type tree,
% tree
.
├── Java
├── My\ Books
├── Python\ Files
└── Samples
└── Sub-folder
4 directories, 1 file
As you can see when I ran the tree command on the Desktop - it displayed all the folders and files it contains, with a summary of how many files are folders are present in Desktop. The dot represents the root. and you can see the files or folders within a file with an indent.
If you want to restrict the number of levels you want to see you can use -L option followed the level number to reduce the depth.
Example:code2care@mac Desktop % tree -L 1
.
├── Java
├── My\ Books
├── Python\ Files
└── Samples
4 directories, 0 files
More Posts related to MacOS,
- How to show line numbers in Nano on Mac
- How to install Jupyter Notebook on macOS Sonoma
- How to Disable Remote Management using Mac Terminal
- Test internet speed using macOS Terminal command
- Docker Desktop needs privileged access macOS
- Google Search Hot Trends Screensaver for Mac OS X
- How to do calculations in Mac Terminal
- How to make TextEdit the default text Editor on Mac
- How to Show Full Website Address on Safari for Mac (Ventura/Sonoma)
- The Zsh Shell - Mac Tutorial
- Opening mac Terminal
- How to change the name of your Mac running on macOS Ventura 13
- How to find the Battery Cycle Count on macOS Ventura
- How to set an emoji as Zsh terminal prompt in macOS
- How to access Trash Folder using Mac Terminal Command
- macOS Ventura XCode Command Line Tools Installation
- Hide Bluetooth icon on Mac Menu Bar macOS Ventura 13
- How to run .sh file in Mac Terminal
- Terminal Command to get the list of available shells in macOS
- How to see Storage Information on macOS Ventura
- How to Go To /usr/local/bin on Mac Terminal?
- How to do screen recording on Mac
- How to Find File and Directory Size in Mac Terminal
- Open .bash_profile File in TextEdit using Terminal
- Remove Now Playing icon from macOS Big Sur Menu Bar
More Posts:
- How to Add a horizontal line in Android Layout - Android
- Calculate days between dates using dateutils ddiff command - Linux
- Reading JSON file in Python with Examples - Python
- Error 404 Tomcat homepage http://localhost:8080/ not displayed - Tomcat
- 5+ Fibonacci number Series Java Program Examples [ 0 1 1 2 3 ..] - Java
- pip install see the list of all available versions of package - PIP
- Tomcat Manager Default Username and Password - Tomcat
- Open Terminal in Finder Current Location - MacOS