LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

cargo-tree

Display the dependency graph as a tree

TLDR

Show dependency tree
$ cargo tree
copy
Show inverted tree for package
$ cargo tree --invert [package]
copy
Show duplicate dependencies
$ cargo tree --duplicates
copy
Show features enabled by dependencies
$ cargo tree --edges features
copy
Show without deduplication
$ cargo tree --no-dedupe
copy
Show specific package subtree
$ cargo tree -p [package]
copy
ASCII output
$ cargo tree --charset ascii
copy

SYNOPSIS

cargo tree [options]

DESCRIPTION

cargo tree displays a tree visualization of the dependency graph for a Rust project. It shows all packages and their transitive dependencies in an indented tree format, with packages marked `(*)` indicating they have already been shown elsewhere and are deduplicated.The command supports several analysis modes: `--invert` traces which packages depend on a given crate, `--duplicates` shows packages that appear multiple times with different versions, and `--edges features` reveals how features propagate through the dependency graph. Built into Cargo since Rust 1.44, it replaced the earlier `cargo-tree` third-party plugin.

PARAMETERS

-i, --invert spec

Invert tree, showing what depends on package
-p, --package spec
Package to use as tree root
-e, --edges kinds
Dependency types: normal, dev, build, features, all
-d, --duplicates
Show packages built multiple times
--no-dedupe
Don't deduplicate repeated packages
--depth n
Maximum display depth
--prune spec
Prune packages from display
--charset set
Character set: utf8, ascii
--format fmt
Format string for package display
--prefix prefix
Prefix: indent, depth, none
--target triple
Filter for target platform
--all-features
Enable all features
--features features
Enable specific features

OUTPUT SYMBOLS

**(*)** Package already shown elsewhere (deduplicated)

INSTALL

sudo apt install cargo
copy
sudo dnf install cargo
copy
sudo apk add cargo
copy
sudo zypper install cargo
copy
nix profile install nixpkgs#cargo
copy

CAVEATS

Use --invert to trace where a dependency comes from. Combine with --edges features to understand feature propagation.

SEE ALSO

RESOURCES

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid