Useful cargo commands
30. April 2018 · 6 minutes read · Commentscargo rust tools
Some additional cargo commands exist to provide unprecedented level of support and extensibility to regular cargo. Here's a list of commands I use (will be updated over time, last update 2024-05-21):
Commands that run via cargo
Sorted alphabetically:
cargo-aoc - Advent of Code helper.
cargo-asm - see the assembly (with cargo asm
) or llvm-ir (with cargo llvm-ir
) generated for Rust code.
cargo-audit - audit Cargo.lock for security vulnerabilities.
cargo-binutils - proxy for LLVM tools like llvm-nm, llvm-objdump and llvm-size. Beware of nasty LLVM bugs like this one.
cargo-bloat - find out what takes most of the space in your executable.
cargo-bundle - create OS-specific app bundles from rust binaries.
cargo-cache - manage and clean cargo cache.
cargo-clippy - over 300 lints to make your Rust code tidy.
cargo-deny - manage large dependency graphs, check licenses, security advisories or outright ban certain packages.
cargo-dfu - flash embedded firmware using DFU.
cargo-edit - cargo add
, cargo rm
, and cargo upgrade
Cargo.toml dependencies.
cargo-expand - show result of macro expansion and #[derive] expansion.
cargo-fix - automatically apply fix-it suggestions from rustc and clippy to entire project. For better effect, run cargo clean
first, then cargo fix --clippy
.
cargo-fmt - format Rust code, applies rustfmt to entire crate.
cargo-fuzz - use libFuzzer to fuzz your code easily.
cargo-geiger - count number of unsafe
operations in crate and its dependencies.
cargo-generate - generate cargo project from a given template.
cargo-graph - create GraphViz DOT files and dependency graphs.
cargo-insta - snapshot testing using insta.
cargo-make - a decent replacement for make.
cargo-outdated - display out-of-date dependencies.
cargo-play - instant playground. Run your code from single .rs file like if it was a full rust project.
cargo-release - for when you're ready to share your crate with the world, automates mundane release tasks - bumping versions, tagging repo, updating docs, etc.
cargo-src - detailed rust source code browser with semantic details.
cargo-sweep - clean unused build files.
cargo-testify - show popup notifications about testing results.
cargo-tree - visualise crate dependencies as a tree.
cargo-update - add cargo install-update
command to upgrade already installed binaries.
cargo-vendor - vendor dependencies into a local directory.
cargo-watch - add a cargo watch
command to monitor and rebuild source in case of changes.
cargo-web - automatically build and run web projects (use with parcel for amazing results).
Standalone commands
Sorted alphabetically:
aarch64-esr-decoder - decode aarch64 Exception Syndrome Register values quickly.
bandwhich - a CLI network monitor.
bat - cat with wings. Replace your cat command with a nicer one by doing "alias cat bat".
bingrep - cross-platform binary parser and colorizer. See binary file headers in a nice way.
biodiff - compare binary files using sequence alignment. Makes it easier to see diffs in files that are aaaalmost the same.
bootimage - create a bootable OS image from a kernel binary. Integrates with cargo.
broot - a CLI file manager with nice tree navigation.
cc-cli - git hook for conventional commits - "git commit" and pick details using a CLI.
clog-cli - conventional commits changelog generator. Old.
cocogitto - conventional commits swiss army knife. Does everything.
commit-emoji - git hook to add emoji to your conventional commits. Mine.
convco - conventional commits tooling, similar to cocogitto.
dirstat-rs - graphical (CLI) directory tree size statistics. Really nice and fast.
dts_viewer - a CLI viewer for device tree files (DTS, source).
du-dust - graphical (CLI) disk usage statistics. Pretty and fast.
dua-cli - Disk Usage Analyzer. Graphical (CLI) disk usage statistics.
elfcat - generates a cross-referenced HTML file with contents of an input ELF binary.
erdtree - a nicely looking file tree. Be sure to set up one of Nerd Fonts in your terminal.
eza - a modern ls
replacement. Do alias ls eza
.
fd-find - super fast and simple alternative to find
. Do alias find fd
for your interactive sessions (the CLI is not compatible with find so keep the scripts happy).
fdtdump - dump device tree files (DTB, compiled).
just - a quick and easy tool runner, useful for automating repeated tasks.
version-sync - keep your version number in documentation and elsewhere in sync with version specified in Cargo.toml