LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

tre

Modern tree replacement with editor integration

TLDR

Show directory tree
$ tre
copy
Show with hidden
$ tre -a
copy
Limit depth
$ tre -l [2]
copy
With editor integration
$ tre -e
copy
Specific directory
$ tre [path/to/directory]
copy
Show only directories
$ tre -d
copy
Output as JSON
$ tre -j
copy
Exclude paths matching a regex
$ tre -E [pattern]
copy
Portable paths
$ tre -p
copy

SYNOPSIS

tre [-a] [-l depth] [-e] [options] [path]

DESCRIPTION

tre is a modern replacement for the classic tree command, written in Rust. It displays directory structures in a tree format with additional features designed for developer workflows, including editor integration and gitignore awareness.The editor integration mode (-e) numbers each file in the output and creates a shell alias that opens the corresponding file in your editor by number. Portable path mode (-p) outputs paths that can be directly copied and pasted into other commands.By default, tre respects `.gitignore` rules, filtering out ignored files for a cleaner view of project structures. Hidden files are excluded unless explicitly requested with -a.

PARAMETERS

-a, --all

Include hidden files.
-d, --directories
Only list directories.
-l, --limit DEPTH
Maximum depth.
-e, --editor [COMMAND]
Editor integration (numbers files, creates aliases).
-E, --exclude PATTERN
Exclude paths matching a regex. Repeatable.
-j, --json
Output JSON instead of tree diagram.
-p, --portable
Portable absolute paths in editor aliases.
-s, --simple
Ignore .gitignore rules.
-c, --color WHEN
Color output: automatic, always, never.

CAVEATS

Not a drop-in replacement for tree — uses different flag names (e.g. -l instead of -L for depth). Respects .gitignore by default, which can be disabled with -s.

SEE ALSO

tree(1), exa(1), fd(1)

Copied to clipboard
Kai