A directory tree in Linux is most commonly produced by the tree command, but a path-list-based tool like Directory Tree Generator builds a deterministic, copy-pasteable tree from a list of relative file paths without requiring shell access on the target machine. Linux tree works only when you can run a process against the real filesystem, it depends on the package being installed, and its output reflects whatever happens to be on disk at that moment. By contrast, the generator takes a plain list of relative file paths you already have, validates each line, infers directory structure from shared prefixes, and renders the result with Unicode or ASCII connectors. The whole pipeline — validation, tree construction, sorting, and rendering — runs in the current browser tab, so project names and folder structure never leave your machine. This makes the approach well-suited to documenting a Linux project for a README, attaching a directory map to an issue, or showing a teammate the shape of a deployment without granting them shell access.

Why a path-list tree is often what you actually need
Searching for "how to get a directory tree in Linux" usually leads to tree, ls -R, or a find one-liner, and each of those has a job it does well. They all run on the target system, they all reflect the actual filesystem, and they all need someone with shell access to invoke them. When that is exactly the situation — you are sitting at a Linux prompt and want to inspect the layout — those commands are the right answer.
Several real workflows sit just outside that comfortable case. You may want to attach a tree to a GitHub issue but you only have a screenshot or a paste from a colleague. You may be documenting a server you no longer have access to, working from a saved list of paths. You may want a tree in a Markdown document that renders the same way on every reader's screen, free of ANSI color codes. Or you may want a deterministic tree where two teammates typing the same paths get byte-identical output, regardless of which Linux distribution or filesystem collation is involved.
A path-list generator is a different category of tool. It is not a filesystem scanner and it does not check whether a typed path is real; it is a deterministic text transformer. That distinction matters because it is the reason the same input produces the same tree on every supported browser, and the reason nothing about your project leaves the machine it was typed on.
Capture Linux file paths into a paste-ready list
The generator expects exactly one complete relative file path per line, with all lines using the same separator. Most path lists you can produce on a Linux box already match that shape, so the first job is to collect them and trim any decoration the shell added.
Three commands cover the common cases. Each prints one path per line, relative to the current directory, which is the form the generator accepts directly:
- find . -type f -printf '%P\n' — prints the path of every regular file under the current directory, with no leading ./ and no recursion into .git unless you add filters.
- find . -type f | sed 's|^\./||' — the same idea when -printf is not available, using a one-character sed substitution to strip the ./ prefix that find prepends by default.
- tree -fi --noreport — tree in full-path mode (-f), with no indentation (-i) and no trailing summary (--noreport). The output is one path per line, ready to paste, and you can add --gitignore or pipe through grep -v to drop generated files.
For a quick sanity pass, the Basic Linux Commands cheat sheet lists conservative templates that produce clean output without destructive flags. Once you have the list, paste it straight into the input box. Empty trailing lines, bare carriage returns, absolute paths, drive-root paths, dot segments, and parent-traversal segments are rejected, so the generator surfaces mistakes in the list itself rather than producing a misleading tree.
Build the tree in Directory Tree Generator
- Paste one complete relative file path per line. Keep every path on the same separator style. Each line represents a file, not a directory declaration, so parent folders are inferred from shared prefixes. For example, src/components/Button.tsx and src/index.ts together imply one src directory containing a components directory and an index.ts file.
- Pick the separator that matches your input. Choose forward slash for paths such as src/lib/parser.ts or backslash for paths such as src\lib\parser.ts. The opposite separator is rejected anywhere in the run instead of being guessed or silently replaced.
- Select Unicode or ASCII tree characters. Unicode mode uses box-drawing connectors; ASCII mode uses ordinary keyboard characters so the tree stays readable on terminals and documents that do not display box-drawing glyphs reliably.
- Click Generate tree. The generator validates each line, builds the prefix tree, sorts directories before files at each level using UTF-16 code-unit comparison, and renders the result starting from a single dot root.
- Review the node count and full tree, then copy. The output panel shows the rendered tree and a count of nodes. Copy it directly into a README, an issue, a code review, or a support message. If clipboard permission is unavailable, the complete output remains visible and selectable for manual copying.
Separator, connector, and validation rules
Three properties of the generator are strict by design, and understanding them avoids most of the friction new users hit.
Separator handling. The tool refuses to mix separators inside a single run. Leading separators, Windows drive-root forms, empty segments created by doubled or trailing separators, the current-directory segment, and parent-traversal segments are all rejected. The generator does not normalize a dangerous or ambiguous path into a different path behind your back, so what you see in the input is what becomes part of the tree.
Name preservation. Ordinary spaces, dots, leading dots, and letter case are kept exactly as typed. Names are not trimmed, lowercased, slugified, decoded, or renamed. README draft.md, .env.example, archive.v1, and data file.json round-trip unchanged. ASCII control characters, including a bare carriage return, are rejected because they can split terminal output or make a displayed tree misleading.
File and directory conflict rules. Each line declares a file. A standalone src line therefore means a file named src, not a folder, while src/index.ts creates a src directory that holds index.ts. Supplying both src and src/index.ts is an explicit file/directory conflict and is rejected. Duplicate paths are also rejected rather than silently deduplicated, because merging them would change the meaning of the input. The same checks reject a path that tries to declare a file under a prefix that already contains children, in either direction.
| Connector style | Mid-level branch | Final branch | Continuation line |
|---|---|---|---|
| Unicode (box-drawing) | ├── | └── | │ |
| ASCII (keyboard only) | |-- | `-- | | |
The structural rules in both modes are identical: directories are listed before files at each level, and within those two groups names are ordered by deterministic UTF-16 code-unit comparison rather than browser locale, operating-system collation, input order, or filesystem metadata. Switching between Unicode and ASCII clears any prior tree immediately, so an earlier output cannot be mistaken for the current settings.
Paste the tree where it needs to live
A clean tree is most useful in three places, and the format it needs to land in is slightly different in each.
README and onboarding docs. A tree block near the top of a project README gives new contributors the shape of the codebase without forcing them to clone and inspect it themselves. Because the output is plain text with no ANSI escapes, it pastes into Markdown fenced code blocks without any preprocessing. If the tree is meant to remain stable across releases, anchor it on a small curated list of paths rather than the full filesystem; reviewers can update the list in one place and regenerate the tree.
Issue threads and code review. When a bug report or a pull-request comment needs context, a short tree pointing at the affected module is easier to scan than a wall of file names. The Unicode mode produces compact, branched output that renders well in GitHub, GitLab, and Bitbucket comments, while ASCII mode is the safer choice when the destination is a plain-text email or a terminal that may not support box-drawing characters.
Architecture notes and support messages. A directory map attached to an architecture decision record, a runbook, or a vendor support ticket turns a written description of "the upload service" into something a stranger can verify at a glance. Two caveats are worth repeating. Project trees can reveal internal module names, customer names, deployment layouts, or security-sensitive filenames even when file contents are absent, so review the tree before publishing it. The generator does not redact secrets, inspect ignore files, label symlinks, calculate sizes, add file comments, discover permissions, or compare a typed list with a real repository, so treat it as a deterministic text transformer rather than a filesystem scanner.