tre
Display directory contents as a tree
TLDR
Print directories only
Print JSON containing files in the tree hierarchy instead of the normal tree diagram
Print files and directories up to the specified depth limit (where 1 means the current directory)
Print all hidden files and directories using the specified colorization mode
Print files within the tree hierarchy, assigning a shell alias to each file that, when called, will open the associated file using the provided command (or in $EDITOR by default)
Print files within the tree hierarchy, excluding all paths that match the provided regex
Display version
Display help
SYNOPSIS
tree [options] [directory ...]
PARAMETERS
-a
All files are printed. By default, dot-files (those beginning with a dot '.') are not printed.
-d
List directories only.
-L level
Descend only level directories deep.
-F
Append a '/' for directories, '=' for sockets, '*' for executables, '|' for FIFOs, and '@' for symbolic links.
-h
Print file sizes in a human-readable format (e.g., 1K, 234M, 2G).
-p
Print file permissions for each file.
-s
Print the size of each file in bytes.
-t
Sort the output by last modification time, newest first.
-r
Reverse the order of the sort.
-P pattern
List only those files that match the wildcard pattern.
-I pattern
Do not list those files that match the wildcard pattern.
-o filename
Output to filename instead of stdout.
DESCRIPTION
tree is a recursive directory listing program that produces a depth indented listing of files, which is colorized by default. With no arguments, tree lists the files in the current directory. When directory arguments are given, tree lists all the files and directories found in them. It has many options to control the output format, filter entries, and display additional information such as file permissions, sizes, and last modification times.
CAVEATS
The command 'tre' is not a standard Linux command and is very likely a common typographical error for 'tree'. This response provides information for the 'tree' command. The 'tree' command is not part of the GNU core utilities and might need to be installed separately using your distribution's package manager (e.g., apt install tree or yum install tree).
INSTALLATION
Since tree is not pre-installed on all systems, you can typically install it using your distribution's package manager:
Debian/Ubuntu: sudo apt update && sudo apt install tree
Fedora/RHEL/CentOS: sudo dnf install tree or sudo yum install tree
Arch Linux: sudo pacman -S tree
COMMON USE CASES
Here are some common ways to use tree:
Displaying current directory structure: tree
Limiting depth: tree -L 2
Showing hidden files and permissions: tree -a -p
Excluding certain files: tree -I 'node_modules|*.log'
Saving output to a file: tree -o structure.txt
HISTORY
The tree command has been a popular third-party utility in the Unix/Linux ecosystem for many years, providing a more visual and intuitive way to explore file system hierarchies compared to ls. Its exact origin date is not widely documented as a single project, but it has been a common tool distributed through various package managers across Linux distributions.