Files
linux.softwareshinobi.com/landing/docs/.recycle/.recycle2/095-the-tree-command.md
Software Shinobi 7d9171c854
All checks were successful
learn org at code.softwareshinobi.com/linux.softwareshinobi.com/pipeline/head This commit looks good
reworking content
2025-06-19 10:03:08 -04:00

1.4 KiB

The tree command

The tree command in Linux recursively lists directories as tree structures. Each listing is indented according to its depth relative to root of the tree.

Examples:

  1. Show a tree representation of the current directory.
tree
  1. -L NUMBER limits the depth of recursion to avoid display very deep trees.
tree -L 2 /

Syntax:

tree  [-acdfghilnpqrstuvxACDFQNSUX]  [-L  level [-R]] [-H baseHREF] [-T title]
      [-o filename] [--nolinks] [-P pattern] [-I  pattern]  [--inodes]
      [--device] [--noreport] [--dirsfirst] [--version] [--help] [--filelimit #]
      [--si] [--prune] [--du] [--timefmt  format]  [--matchdirs]  [--from-file]
      [--] [directory ...]

Additional Flags and their Functionalities:

Flag Description
-a Print all files, including hidden ones.
-d Only list directories.
-l Follow symbolic links into directories.
-f Print the full path to each listing, not just its basename.
-x Do not move across file-systems.
-L # Limit recursion depth to #.
-P REGEX Recurse, but only list files that match the REGEX.
-I REGEX Recurse, but do not list files that match the REGEX.
--ignore-case Ignore case while pattern-matching.
--prune Prune empty directories from output.
--filelimit # Omit directories that contain more than # files.
-o FILE Redirect STDOUT output to FILE.
-i Do not output indentation.