command module
Version: v0.0.0-...-edfd1c3 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2020 License: MIT Imports: 9 Imported by: 0


tree Go Report Card

tree is a re-implementation of tree Linux utility using Go language. This implementation tries to be a Go-idiomatic. Only subset of features is implemented. Noticable absence is no ability to output in HTML format. The implementation might be a bit less efficient then C-based, as it always does lstat(2) on each directory or file node processed.


go get


$ tree -h
Usage of tree:
  -F	show decorations like 'ls -F'
  -a	show hidden files
    	print SHA1 checksum for files
  -d	only show directories
  -f	show relative paths
  -i	do not show indentation lines
    	do not display file and directory counts
  -o string
    	stdout(-)|stderr|/dev/null|file (default "-")


By default, tree will examine current directory. Here is a sample output.

$ tree
├── formatter
│   └── formatter.go
├── node
│   └── node.go
├── tree.go
└── walker
    └── walker.go

3 directories, 5 files

Running tree with -checksum option will force -i and -f flags and display SHA1 checksum as a first column. Checksum will be calculated for regular files only. Directory entries will be skipped.

$ tree -checksum .
ee90047c6959c8e9dafac944595fd41f845a2438 ./
ce24834954211cbc5f4d59ab8422e290e219d1b8 ./formatter/formatter.go
2455ec80bb114e5709be49c9620408eba1264f7e ./node/node.go
90bc93d03dde9125c3f90335cc2caa398f010cc6 ./tree.go
9b24c61d6f4c7543734ad7abdbd8823b1f4d0c06 ./walker/walker.go

3 directories, 5 files


The Go Gopher

There is no documentation for this package.

Source Files


Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL