gtree is a command similar to the tree
command that works on any operating system, written in Go and that displays file icons.
First you need to have the Go programming language installed on your system, examples of how to install Go:
Windows(with WinGet in PowerShell):
winget install -e --id GoLang.Go.1.19
brew install go
Ubuntu(with APT):
sudo apt install golang-go
Now just clone the repository and run the commands below:
git clone https://github.com/kitagry/gtree
cd gtree
go get github.com/kitagry/gtree
go build .
And move it to a folder on your system, for example:
Example on UNIX-like systems.
sudo install -v gtree /usr/local/bin/
It’s good to remove the files and folders made to build, example:
cd ..
rm -rf gtree/
sudo rm -rf go/
And test:
gtree --version
gtree .
IMPORTANT TIP: Avoid using the trailing slash, example: Instead of:
gtree mydir/
Use it like this:
gtree mydir
It doesn’t display the files in the folders when there is a slash/
at the end.
For more information, access the repository on GitHub and use the help: gtree --help
.