Forrest logo
tool overview
On this page you find all important commands for the CLI tool tree. If the command you are looking for is missing please ask our AI.

tree

Tree is a command line tool that displays the structure of directories and files in a tree-like format on Unix-like operating systems. It allows users to visualize the hierarchical organization of files and directories in a clear and structured manner.

  1. Tree is a simple yet powerful utility that helps users explore and understand directory structures.
  2. Upon execution, tree starts from the current directory and displays the directory structure recursively.
  3. By default, tree displays directories before files, with an indentation indicating the hierarchy.
  4. The output of tree includes the names of directories and files, along with various metadata such as size and permissions.
  5. Users can customize the output using various command line options to filter or exclude specific files or directories.
  6. Tree supports a variety of options, like displaying only directories or files, showing hidden files, or limiting the depth of the tree.
  7. Users can also control the level of indentation, include file sizes, show file permissions, or print the tree in color.
  8. Tree is commonly used for directory navigation, file discovery, and obtaining an overview of large directory structures.
  9. It is particularly useful for developers, sysadmins, and other professionals dealing with a vast number of files and directories.
  10. Tree is open source and widely available, offering compatibility across various Unix-like systems including Linux and macOS.

List of commands for tree:

  • tree:tldr:077fa tree: Print hidden files too with colorization on.
    $ tree -a -C
    try on your machine
    explain this command
  • tree:tldr:23a82 tree: Print files and directories up to 'num' levels of depth (where 1 means the current directory).
    $ tree -L ${num}
    try on your machine
    explain this command
  • tree:tldr:46ed9 tree: Print directories only.
    $ tree -d
    try on your machine
    explain this command
  • tree:tldr:51385 tree: Display the tree using ASCII characters instead of extended characters.
    $ tree ${path\to\directory} /a
    try on your machine
    explain this command
  • tree:tldr:65245 tree: Print the size of each file and the cumulative size of each directory, in human-readable format.
    $ tree -s -h --du
    try on your machine
    explain this command
  • tree:tldr:75a19 tree: Display the tree for a specific directory.
    $ tree ${path\to\directory}
    try on your machine
    explain this command
  • tree:tldr:97d69 tree: Print the tree without indentation lines, showing the full path instead (use `-N` to not escape non-printable characters).
    $ tree -i -f
    try on your machine
    explain this command
  • tree:tldr:b776d tree: Print files within the tree hierarchy, using a wildcard (glob) pattern, and pruning out directories that don't contain matching files.
    $ tree -P '${*-txt}' --prune
    try on your machine
    explain this command
  • tree:tldr:c0af7 tree: Display the tree for the current directory.
    $ tree
    try on your machine
    explain this command
  • tree:tldr:d6b2a tree: Print directories within the tree hierarchy, using the wildcard (glob) pattern, and pruning out directories that aren't ancestors of the wanted one.
    $ tree -P ${directory_name} --matchdirs --prune
    try on your machine
    explain this command
  • tree:tldr:e076b tree: Display the tree for a directory including files.
    $ tree ${path\to\directory} /f
    try on your machine
    explain this command
tool overview