VisualizationΒΆ
The visualize command renders a directory structure as a color-coded tree in the terminal. This guide covers its display options.
Basic VisualizationΒΆ
recursivist visualize # current directory
recursivist visualize /path/to/project # a specific directory
A progress indicator is shown while the directory is scanned, then the tree is printed:
π my-project
βββ π README.md
βββ π setup.py
βββ π requirements.txt
βββ π src
βββ π main.py
βββ π utils.py
βββ π tests
βββ π test_main.py
βββ π test_utils.py
Within each directory, files appear before subdirectories. Files are ordered by extension and then name.
Color CodingΒΆ
Each file extension is assigned a unique color, generated deterministically from the extension itself. The same extension always gets the same color, and the algorithm spaces colors apart so different types stay visually distinct.
Icon StylesΒΆ
Use file-type-specific Nerd Font glyphs instead of the generic emoji for a single run:
To make a style the default, see Basic Usage.
File StatisticsΒΆ
Recursivist keeps two things separate: how files are ordered and what each file is annotated with. That gives three families of flags:
- Combined β
--sort-by-loc,--sort-by-size,--sort-by-mtimeeach sort files by a metric and annotate every file with it. - Display-only β
--loc,--size,--mtimeannotate files with a metric without touching the order. - Sorting-only β
--sort-by-similarityreorders without annotating (covered below).
The combined flags below are the quickest way to see one metric. To mix sorting and annotation freely, see Combining Statistics.
Lines of CodeΒΆ
Count lines per file and total them per directory:
π my-project (1262 lines)
βββ π README.md (124 lines)
βββ π setup.py (65 lines)
βββ π requirements.txt (18 lines)
βββ π src (1055 lines)
βββ π main.py (245 lines)
βββ π utils.py (157 lines)
βββ π tests (653 lines)
βββ π test_main.py (412 lines)
βββ π test_utils.py (241 lines)
File SizesΒΆ
Display sizes with units (B, KB, MB, GB):
π my-project (57.1 KB)
βββ π README.md (4.2 KB)
βββ π setup.py (3.8 KB)
βββ π requirements.txt (512 B)
βββ π src (48.6 KB)
βββ π main.py (12.4 KB)
βββ π utils.py (8.2 KB)
βββ π tests (28.0 KB)
βββ π test_main.py (18.6 KB)
βββ π test_utils.py (9.4 KB)
Modification TimesΒΆ
Show when files were last modified, with recency-aware formatting (Today HH:MM, Yesterday HH:MM, a weekday and time within the last week, Mon DD earlier this year, or YYYY-MM-DD for older files):
π my-project (Today 14:30)
βββ π README.md (Today 10:15)
βββ π setup.py (Today 09:00)
βββ π requirements.txt (Yesterday 16:00)
βββ π src (Today 14:30)
βββ π main.py (Today 14:30)
βββ π utils.py (Today 09:15)
βββ π tests (Today 14:25)
βββ π test_main.py (Today 14:25)
βββ π test_utils.py (Yesterday 18:10)
Displaying Without SortingΒΆ
Use the display-only flags β --loc, --size, --mtime β to annotate files while keeping the default extension-and-name ordering:
recursivist visualize --size # show sizes, don't reorder
recursivist visualize --loc --mtime # show LOC and mtime, don't reorder
Display-only annotations appear in the exact order you list the flags, so --loc --mtime and --mtime --loc differ only in column order.
Combining StatisticsΒΆ
You can sort by one metric and annotate with several. Pair a single sorting flag with as many display-only flags as you like:
π my-project (1262 lines, 57.1 KB, Today 14:30)
βββ π README.md (124 lines, 4.2 KB, Today 10:15)
βββ π setup.py (65 lines, 3.8 KB, Today 09:00)
βββ π requirements.txt (18 lines, 512 B, Yesterday 16:00)
βββ π src (1055 lines, 48.6 KB, Today 14:30)
βββ π main.py (245 lines, 12.4 KB, Today 14:30)
βββ π utils.py (157 lines, 8.2 KB, Today 09:15)
βββ π tests (653 lines, 28.0 KB, Today 14:25)
βββ π test_main.py (412 lines, 18.6 KB, Today 14:25)
βββ π test_utils.py (241 lines, 9.4 KB, Yesterday 18:10)
Here files are ordered by lines of code (the sort metric, descending), and each is annotated with LOC, size, and modification time.
Flags are resolved by their left-to-right order on the command line:
- Only the first sorting flag takes effect. A second
--sort-by-*is discarded entirely β so--sort-by-loc --sort-by-sizesorts by LOC and shows only LOC, not both. Use--sort-by-loc --sizeto sort by LOC and display size too. - A winning combined numeric metric annotates first; display-only annotations follow in the order given.
See the CLI Reference for the complete resolution rules.
Grouping by Name SimilarityΒΆ
This groups files with similar names next to each other (for example, main.py beside main.js). It replaces the default extension-and-name ordering. Because only the first sorting flag on the command line takes effect, --sort-by-similarity wins only if it comes before any metric or Git-status sort; a sorting flag given earlier takes precedence and the similarity flag is ignored.
Git StatusΒΆ
Inside a Git repository, annotate files with their status:
π my-project
βββ π README.md
βββ π newfile.txt [U]
βββ π src
βββ π main.py
βββ π utils.py [M]
Markers are [U] untracked, [M] modified, [A] added, and [D] deleted. Deleted files are also shown struck through, and a file deleted from disk is still listed so the change is visible. If the directory isn't inside a repository (or has no changes), no markers are added.
--git-status is display-only β it annotates without changing the order. To also sort by Git status (modified, added, deleted, untracked, then clean), use the combined flag:
The Git-status marker always trails at the very end of a file's annotations, after any metric parenthetical. For example, --sort-by-loc --git-status shows main.py (245 lines) [M].
Directory Depth ControlΒΆ
Limit how deep the tree goes β useful for large projects:
π my-project
βββ π README.md
βββ π src
βββ π main.py
βββ π utils.py
βββ π tests
tests keeps its open folder icon, so you can tell it was cut off rather than empty.
Full Path DisplayΒΆ
Show absolute paths instead of bare filenames:
π my-project
βββ π /home/user/my-project/README.md
βββ π src
βββ π /home/user/my-project/src/main.py
For a GitHub repository, --full-path shows each file's canonical blob URL instead of a filesystem path (see GitHub Repositories).
GitHub RepositoriesΒΆ
visualize accepts a GitHub repository URL in place of a local directory. The repository is downloaded to a temporary directory, rendered like any local tree, and removed when the command finishes:
Pin a branch, tag, or commit β and, optionally, a subtree β with a /tree/<ref> or /blob/<ref>/<subpath> selector:
recursivist visualize https://github.com/owner/repo/tree/develop
recursivist visualize https://github.com/owner/repo/tree/main/src
When no ref is pinned, the default branch is used. Set GITHUB_TOKEN (or GH_TOKEN) to raise GitHub's rate limits and to reach private repositories. Lines of code (--loc, --sort-by-loc) and size (--size, --sort-by-size) are read from the file contents and apply normally, and --full-path shows each file's blob URL. The options tied to a working copy β --git-status, --sort-by-git-status, --mtime, --sort-by-mtime, and --ignore-file β do not apply to a hosted repository and are skipped, with a message noting which. The CLI Reference lists every accepted URL form.
FilteringΒΆ
All of Recursivist's filtering options apply to visualize:
recursivist visualize --exclude node_modules --exclude .git
recursivist visualize --exclude-ext .pyc --exclude-ext .log
recursivist visualize --exclude-pattern "*.test.js" --exclude-pattern "*.spec.js"
recursivist visualize --exclude-pattern "^test_.*\.py$" --regex
recursivist visualize --include-pattern "*.py" --include-pattern "*.md"
recursivist visualize --ignore-file .gitignore
See Pattern Filtering for details.
Performance TipsΒΆ
For very large directories:
- Limit depth with
--depth. - Exclude heavy directories (
node_modules,.git, build output) with--exclude. - Use include patterns to focus on the part of the tree you care about.
- Be aware that
--sort-by-locreads every file to count lines, which is slower on large repositories.
Related CommandsΒΆ
For every option, see the CLI Reference.